0

Following this question , and according this answer .

I try to make same list but with <p>...</p> wraped in each <li> , seems it works but my problem is that it break a line for each <li> .

Here it with NO <p> - http://jsfiddle.net/urielz/tv5fV/ ,

and here it with the <p> - http://jsfiddle.net/urielz/2ANwJ/1/

How to make the 2nd (with <p>) to be looks like the 1st (no <p>) ?

Preferably answers with just css edit , but jQuery also would be acceptable .

Community
  • 1
  • 1
URL87
  • 10,667
  • 35
  • 107
  • 174

2 Answers2

1

use display:inline for your <p> tags:

li p {display:inline}

Making it 'inline' will remove the line break since it will no longer be a block-level element and also it will get rid of the margins that browsers use by default for <p> tags.

See this Updated and working fiddle

Reinder Wit
  • 6,490
  • 1
  • 25
  • 36
1

use display:inline or display:inline-block; for the <p> tag.

By default, <p> tags are set as display:block;, which will break your content to a new line. espacially when you use content using :before

http://jsfiddle.net/2ANwJ/7/

li > p { 
    display: inline; 
}
Luke
  • 8,235
  • 3
  • 22
  • 36