SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Member
    Join Date
    Jul 2008
    Posts
    7
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Here's an interesting question:

    Hello,

    I am currently working on a site and wanted to style the first few words
    of some of my <p>'s.

    I used the span tag and gave it a class.

    When checking on a validator, it came up as erroneous because spans are block elements (I think thats right?) and they cannot go inside another block element (excuse my ignorance, but I am pretty sure this is why they don't validate).

    As an experiment, I removed all of my "span class=" tags and replaced with
    "del class=" I then set the respective styles to "text-decoration:none;"

    I have been told on other board that this is a big no-no because it is semantically incorrect. If so, then why are my pages 100% compliant??

    Does anyone have advice what to replace those del tags with so that I can
    be w3c compliant AND semantically correct?

    Here is an example of the code:
    Code:
    <p><del class="bigtext">Liver Organ System</del> - In order to conceive and have a
    the website is holisticfertility.us feel free to check the validators.

    Thanks
    blutz

  2. #2
    SitePoint Guru
    Join Date
    Nov 2005
    Location
    Norway
    Posts
    715
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Why not just use <em> for this?
    Code:
    <p><em>Liver Organ System</em> - In order to conceive and have a..</p>
    http://reference.sitepoint.com/html/em

    Or perhaps <strong> makes more sense:
    Code:
    <p><strong>Liver Organ System</strong> - In order to conceive and have a..</p>
    http://reference.sitepoint.com/html/strong

  3. #3
    SitePoint Member
    Join Date
    Jul 2008
    Posts
    7
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    obviously not as interesting of a question as I thought LOL!

    thanks for taking the time to help a newb.

    for some reason I didn't think that you could give <em> or <strong>
    a class (brain fart)

    thanks again,
    blutz

  4. #4
    SitePoint Guru Ize's Avatar
    Join Date
    Nov 2005
    Location
    The Netherlands
    Posts
    808
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You can give any HTML element a class or an id Btw, you wouldn't need a class or id because you could also use:

    Code:
    p em { font-size: large; }
    Also, a span is an inline element, the validation error must've been triggered by something else.

    Also, semantically correct is not the same as validating. This validates:

    Code html:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
    	"http://www.w3.org/TR/html4/strict.dtd">
    <title>This validates!</title>
    <p><b>This is my page header!</b><br><br>
    This is my page content!

    yet it's far from semantically correct

  5. #5
    SitePoint Member
    Join Date
    Jul 2008
    Posts
    7
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ize

    Good advice there, thank you.

    blutz


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
  •