Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

<u> alternative when using html 4.01 strict

Featured Replies

Hi

 

I have validated my webpages and found this to be the last error I have to sort out. I was wondering how would be the best way to solve it as I would quite like to be able to underline a few choice words within a paragraph. Everywhere just keeps saying use css, but I'm not sure how I would assign the right id to be able to have just these words underlined.

 

<p>Closing date for entries: <b><u>5th July 2009</u></b></p>

 

Many thanks

 

bethlou

Wrap your chosen words in a <span> tag and use CSS to style it with an underline. If you are semantically emphasising the words, then you could use <em> and use css to remove the italics and to add the underline.

Would a class of underline not work?

 

.underline
{
text-decoration: underline;
}

 

then use:

 

<p>Closing date for entries: <b><span class="underline">5th July 2009</span></b></p>

 

Not sure if Span is valid in html 4.01 strict though.... :p

why not just attach it to the b tag?

 

<b class="underline"> text </b>

 

Save on the span tag...make code nice and clean :)

 

 

Both will validate though, so choice is yours :p

  • Author
Wrap your chosen words in a <span> tag and use CSS to style it with an underline. If you are semantically emphasising the words, then you could use <em> and use css to remove the italics and to add the underline.

Thank you that sounds perfect. Forgive the lack of knowledge but would this be correct:

 

in the html document =

Closing date: <span>5 july 2009</span>

 

in the css document =

span {

text-style: underline;

}

 

or

 

in the html document=

Closing date: <em>5 july 2009</em>

in the css document =

em {

text-style: underline;

font-style: no-italic;

}

 

 

Thank you

out of the two you have put down I would use:

 

in the html document=

Closing date: <em>5 july 2009</em>

in the css document =

em {

text-style: underline;

font-style: no-italic;

}

 

if you are not planning on using the <em> tag for anything else :)

Font-style: normal

 

Not

 

Font-style: no-italic

 

But as Dizi pointed out, you'd be better off creating a class, and assigning it to the <b> tag.

  • Author
Font-style: normal

 

Not

 

Font-style: no-italic

I didn't think that sounded right, thanks.

But as Dizi pointed out, you'd be better off creating a class, and assigning it to the <b> tag.

That's worked much better, and like what was said, much cleaner. Thank you all for your advice.

You're welcome. It's why we're all here.

 

Well, that and the smut :p

Font-style: no-italic

 

Haha, there the mistakes i ALWAYS make, you should print of a html and a css cheat sheet, they're must have for quick reference (:

 

well, that and the smut

 

That's just you and Helen :) although she doesn't seem to have around too much lately, so the build up must frustrating :p

Not sure if Span is valid in html 4.01 strict though.... :p

 

<span> is perfectly valid.

Using a <b> tag is non-semantic. You did not say that you required your text to be bold, rather to be underlined. The meaning of the <b> tag is 'bold' - so it's inappropriate to use it. If you wish to semantically emphasise the text, use <em> or <strong>, if you wish to make the emphasis purely visual, you use the <span> tag (attach a class to that if you have more than one style).

No one said anything about semantics, but if you want to go into that then, span also has no real semantic meaning or value whatsoever.

 

 

As for being inappropriate to use, it isn't really as it is not a depreciated tag...so if you want to have bold text that is not there to add emphasis but just a design value, then <b> is just as semantically incorrect as <span>

 

 

Also I assumed from her code:

 

<p>Closing date for entries: <b><u>5th July 2009</u></b></p>

 

that she wanted it bold and underline...however if she was doing this to add emphasis to the date I would suggest this

 

<p>Closing date for entries: <strong class"underline">5th July 2009 </strong> </p>

 

Rather than using a <b> as <strong> should be used for emphasis of something. Or if you don't mind your all your strong text being underlined you could do this in your css:

 

strong {text-style: underline; }

 

 

and just have your html code as:

 

<p>Closing date for entries: <strong>5th July 2009 </strong> </p>

 

Sorry if that is confusing.

... span also has no real semantic meaning or value whatsoever.

 

That's exactly what I said - in both posts.

 

I give up :p

That's exactly what I said - in both posts.

 

I give up.

 

you didn't you said <b> was semantically in correct, you never once said that <span> is also not semantic, you said span should be used :p but if the text is to be bold in a none emphasised way then <b> is just as valid as <span> would be, as both are meaningless.

  • Author

you guys are so funny, who would have known underlining something was going to cause such a discussion :)

you guys are so funny, who would have known underlining something was going to cause such a discussion :)

 

You're kidding surely?

 

We'd "discuss" about whether or not to use smilies in a post lol :p

This is what web designers call getting passionate about the subject. Everybody else calls it being anal.

 

A further example of being anal would be me pointing out to Dizi that he should actually have used the word deprecated in the following sentence. There is an often over looked difference between the words deprecate and depreciate. Pretty rich coming from me, I have the writing style of a 12 year old.

 

As for being inappropriate to use, it isn't really as it is not a depreciated tag...so if you want to have bold text that is not there to add emphasis but just a design value, then <b> is just as semantically incorrect as <span>
This is what web designers call getting passionate about the subject. Everybody else calls it being anal.

 

A further example of being anal would be me pointing out to Dizi that he should actually have used the word deprecated in the following sentence. There is an often over looked difference between the words deprecate and depreciate. Pretty rich coming from me, I have the writing style of a 12 year old.

 

Or me pointing out that Dizi is actually a SHE...

Pretty rich coming from me, I have the writing style of a 12 year old.

 

That's fine my writing style is that of a spoilt six year old anyway, my spelling and grammar is horrid :lol:

 

 

But welcome to the list of people who have decided to give me a sex change on this forum, you have a lot of company there :)

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.