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 6 of 6
  1. #1
    Regular Coder
    Join Date
    Apr 2010
    Posts
    417
    Thanks
    4
    Thanked 1 Time in 1 Post

    <b></b> causes problems in HTML validator, saying it should not be empty

    Having problems with HTML validator kicking up a fuss with empty tags.

    <b></b>

    seems to be incorrect and I wish to make all my pages valid.

    Can anyone suggest a better way to do this without using images.

    Is there another tag i can use that will not cause this validation problem i have ?


    CSS
    Code:
    .containercolour { position: relative; background: #E1E1E1; margin: 0px 5px; } /* BACKGROUND OF ROUNDED BOX */
    .rtopcolour, .rbottomcolour { display: block; background:#FFFFFF; } /* OUTTER EDGE COLOUR */
    .rtopcolour *, .rbottomcolour *{ display: block; height: 1px; overflow: hidden; background: #E1E1E1; } /* BACKGROUND OF ROUNDED BOX */
    
    .r1{ margin: 0px 5px; line-height: 1px; }
    .r2{ margin: 0px 3px; line-height: 1px; }
    .r3{ margin: 0px 2px; line-height: 1px; }
    .r4{ margin: 0px 1px; line-height: 1px; }
    HTML
    Code:
    <div class="containercolour"><b class="rtopcolour"><b class="r1"></b><b class="r2"></b><b class="r3"></b><b class="r4"></b></b>
    text
    <b class="rbottomcolour4"><b class="r4"></b><b class="r3"></b><b class="r2"></b><b class="r1"></b></b></div>

  • #2
    New Coder
    Join Date
    Jan 2007
    Posts
    15
    Thanks
    0
    Thanked 0 Times in 0 Posts
    What is it your code is trying to accomplish?

    Can you post the whole code, or link a URL to it so that we can see what you're aiming for.

    <b> tags are used to bolden text, it looks as if you're trying to use them as div's?!
    Last edited by VIPStephan; 02-13-2012 at 12:41 PM. Reason: signature rule violation

  • #3
    Senior Coder
    Join Date
    Aug 2010
    Location
    High Point, NC
    Posts
    3,338
    Thanks
    5
    Thanked 363 Times in 360 Posts
    Or are you trying to insert a "break" <br /> ?

  • #4
    Regular Coder
    Join Date
    Aug 2005
    Location
    MS
    Posts
    832
    Thanks
    10
    Thanked 79 Times in 77 Posts
    Tags should never be empty unless you are using the very basic document type that allows them that way. Even empty "p" tags would get flagged at the validator.

    To solve it is to insert a non-breaking space: & nbsp ; (remove spaces). If it is a JavaScript that uses the document.write to insert the image, add the "b" tags in that script if possible. I've seen scripts that target empty tags to insert content and those tags will always be flagged depending on the doctype used.
    ☠ ☠RON☠ ☠

  • #5
    New Coder
    Join Date
    Jul 2010
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Try to use <p></p> tag and <span></span> and use class with these "paragraph" and "span" tags...this can solve your problem...

  • #6
    Regular Coder
    Join Date
    Aug 2005
    Location
    MS
    Posts
    832
    Thanks
    10
    Thanked 79 Times in 77 Posts
    Quote Originally Posted by cools4u View Post
    Try to use <p></p> tag and <span></span> and use class with these "paragraph" and "span" tags...this can solve your problem...
    You still can not use empty tags with certain document types and expect them to validate.
    ☠ ☠RON☠ ☠


  •  

    Posting Permissions

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