...

View Full Version : How do I use classes w/o the p tag?



Crazydog
05-20-2007, 10:03 PM
I want to use classes so I can change how the text looks, but I don't want the whitespace that the <p> tag inserts. How can I use classes without using the p tag?

koyama
05-20-2007, 10:10 PM
I want to use classes so I can change how the text looks, but I don't want the whitespace that the <p> tag inserts. How can I use classes without using the p tag?
I'm not sure what you mean, but if you don't want the default margins of the p element that are usually specified by browsers, then why not use this:


p {margin: 0}

VIPStephan
05-20-2007, 11:11 PM
Any apart from your approach/thinking being the wrong way ’round you can apply classes to almost any HTML element, not just paragraphs.

NancyJ
05-20-2007, 11:46 PM
if you want to change the style of text within a paragraph or other block level element for no particular reason (ie, it wouldnt be better semantically categorised as emphasised or strong) you could wrap it in a span and assign a class to the span

194673
05-21-2007, 03:37 AM
Agree with all the posts above. 'span' tags would be exactly what you're looking for; however, if you just want to get rid of the whitespace of a paragraph then set the margins to 0 as koyama said.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum