Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    Regular Coder
    Join Date
    May 2005
    Posts
    224
    Thanks
    1
    Thanked 0 Times in 0 Posts

    How do I use classes w/o the p tag?

    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?

  • #2
    Senior Coder koyama's Avatar
    Join Date
    Dec 2006
    Location
    Copenhagen, Denmark
    Posts
    1,246
    Thanks
    1
    Thanked 5 Times in 5 Posts
    Quote Originally Posted by Crazydog View Post
    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:
    Code:
    p {margin: 0}
    Last edited by koyama; 05-20-2007 at 10:12 PM. Reason: typo

  • #3
    The fat guy next door VIPStephan's Avatar
    Join Date
    Jan 2006
    Location
    Halle (Saale), Germany
    Posts
    8,793
    Thanks
    6
    Thanked 1,022 Times in 995 Posts
    Any apart from your approach/thinking being the wrong way ’round you can apply classes to almost any HTML element, not just paragraphs.

  • #4
    Senior Coder NancyJ's Avatar
    Join Date
    Feb 2005
    Location
    Bradford, UK
    Posts
    3,174
    Thanks
    19
    Thanked 66 Times in 65 Posts
    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

  • #5
    Regular Coder
    Join Date
    Dec 2006
    Posts
    166
    Thanks
    9
    Thanked 4 Times in 4 Posts
    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.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •