...

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



jasonpc1
09-01-2010, 01:43 PM
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


.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


<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>

richF
09-01-2010, 03:14 PM
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?!

teedoff
09-01-2010, 03:39 PM
Or are you trying to insert a "break" <br /> ?

Major Payne
09-02-2010, 07:38 AM
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.

cools4u
09-02-2010, 01:26 PM
Try to use <p></p> tag and <span></span> and use class with these "paragraph" and "span" tags...this can solve your problem...

Major Payne
09-02-2010, 02:27 PM
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.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum