1

I'm working on a design with justified text-alignment. In order for it to work on the last row I use this hack:

p:after
{content: "";
display: inline-block;
width: 100%;}

It works for alignment, but the problem is that it adds an extra empty line at the end of each p-element. I have come up with the solution

p{
   margin-bottom: -1em;
}

But this won't not make it possible to set a margin to the p element in pixels, wich I would like to. Is there any way to set p:after height to 0? I have tired line-height, negative margins and height, none seem to have any effect.

Himmators
  • 14,278
  • 36
  • 132
  • 223
  • 1
    Why are you trying to set :after as inline-block? I can't understand this moment. And connected with width: 100% its obvious that it always generate extra line. What are you trying to achieve? Why don't you use just p { text-align: justify; } ? – Choinek Oct 23 '13 at 12:08
  • because p{text-align: justify;} won't justify the last line. Here are some details: http://stackoverflow.com/questions/4771304/justify-the-last-line-of-a-div – Himmators Oct 23 '13 at 12:12
  • If you think that the accepted answer to an old question has an essential problem, you should try to contribute to having it improved, rather than open a new question (leaving the possibly unsatisfactory answer around). And primarily you should present the real problem, rather than issue with a trick used to address it. – Jukka K. Korpela Oct 23 '13 at 12:28
  • @JukkaK.Korpela This is all together other question, allthough, it's a result of the solution to another problem. Also I tried to explain my problem to the best of my abilitiy, I added the link for clarification. Based on the grammer, I'm guessing Choinek doesn't have english as his first language(allthough neither do I) this might make it hard to understand my problem. – Himmators Oct 23 '13 at 13:14
  • some techniques here that may help: http://www.barrelny.com/blog/text-align-justify-and-rwd/ – 2507rkt3 Oct 23 '13 at 14:01

0 Answers0