Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Aligning the first letter of a paragraph with CSS ::first-letter Selector

I’d like to achieve this:

enter image description here

Changing the font size of the first letter is easy by using CSS ::first-letter Selector.
But how can I align it with the 2 or 3 lines in front of it?

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

Is this possible with only CSS?
If now, would appreciate any hints on how to achieve this using JS.

>Solution :

what’s your html markup like?
if it’s just a simple

tag, this might help you

The html

p:first-child:first-letter {
  float: left;
  font-size: 75px;
  line-height: 60px;
  padding-top: 4px;
  padding-right: 8px;
  padding-left: 3px;
}
<p> a sentence for your site </p>
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading