SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Guru redhillccwebmas's Avatar
    Join Date
    Jun 2005
    Posts
    989
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Is the <p> tag a block or inline element?

    Hi there,

    I would like to know if the <p> tag is a block or inline element as I wish to assign CSS values such as floats and margins to it.

    Cheers

    James

  2. #2
    Non-Member
    Join Date
    Jan 2005
    Location
    Netherlands
    Posts
    4,300
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hello

    give it a background color and see what happens

    PS you can float almost any Tag, and use padding and margins on it
    a float makes inline tags Block Level, in other words you can build pages with span Tags that use valid html code (Symantic's is an other Story)

    Block Level
    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
    <head>
    <title>12345 12345 12345 12345 12345</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    	<style type="text/css">
    	p{background:#ff6600;}
    	</style>
    	<script type="text/javascript">
    
    	</script>
    </head>
    <body>
    <p>12345</p>
    
    </body>
    </html>

  3. #3
    Non-Member deathshadow's Avatar
    Join Date
    Jul 2006
    Location
    Dublin, NH
    Posts
    901
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    When in doubt, I force the issue... ANY element can be made block level with display:block; or not with display:inline; floating elements that aren't block by default without display:block can result in wierd layout issues in Netscape 8 and IE.

    I just wish display:inline let you set width and height on the element in browsers other than IE - would mean a lot less futzing with floats.


Bookmarks

Posting Permissions

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