🎈

Rocky Essel

A Frontend Developer.

I'm a quietly confident, naturally curious web developer, that loves improving, trying out different idea designs, and coding them out. And my goal is to work in a company where I can deliver business value while also leveling up as a developer.

  • Archive
  • Resume
0
979
•2:24 PM

How to separate a text or element with a dot in TailwindCSS

Jan 21st 231 Mins

[object Object]

TailwindCSS is something you can never stop using once you have tasted it, but if you're new to TailwindCSS, I recommend checking the docs before googling. So let's start.

I'm using Next.js since it can be used in any valid HTML file.

Adding a dot between a text or element or icons can be done quickly with TailwindCSS by using the pseudo-class "after". But let's first do it in HTML and CSS, then in TailwindCSS

HTML

<div class='flex'>
  <span id='sub_heading'>5 Minutes Read</span>
  <span>12:32</span>
</div>

CSS

#sub_heading::after{
  content: '•̀';
  padding-left: 5px;
}

I added "padding-left" to give a little space.

OUTPUT

[object Object]

And that's how it is done in CSS, but in TailwindCSS is it a lot easier and faster at the same time. And here it is:

<div>
  <span className='after:content-["•"] pl-5 ...'>5 Minutes Read</span>
  <span>12:32</span>
</div>

See! Done! TailwindCSS makes it so much easy to accomplish this with ease.

Written by

Rocky Essel

I'm a quietly confident, naturally curious web developer, that loves improving, trying out different idea designs, and coding them out. And my goal is to work in a company where I can deliver business value while also leveling up as a developer.

Like what I do?Hire me

Categories

  • Python
  • Node.js
  • Rust
  • HTML
  • CSS
  • TypeScript
  • ES6 JavaScript
  • Express.js
  • React.js
  • Next.js
  • Git
  • API
  • TailwindCSS
  • Photoshop
  • Figma
  • CMS
  • Sanity CMS
0 comment
Be the first to leave a comment