Jump to content

<p> vs <div> vs something else


Primal

Recommended Posts

Is there another tag you can use as a substitute for <div> or <p> (what's the difference anyway?) that doesn't put a line break after the closing tag?Thanks,Primal

Link to comment
Share on other sites

It's all about semantics. Div defines a devision and p defines a paragraph. You can use CSS to manipulate the looks of either. The line you need in CSS is:

display: inline;

which will treat the selected element as part of a larger text, and as such, will remove any line breaks around.Span is the element to use for real inline text though. It doesn't carry any specific semantics on it's own. It's made to allow custom visualization of inline text.

Link to comment
Share on other sites

You can also adjust the margins and paddings for those elements and get them to display as you prefer. That is one of the advantages to using CSS on your sites. It is so simple to adjust theses things.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...