April 27, 200917 yr 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
April 27, 200917 yr 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.
April 27, 200917 yr 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....
April 27, 200917 yr 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
April 27, 200917 yr 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
April 27, 200917 yr 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
April 27, 200917 yr 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.
April 27, 200917 yr 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.
April 27, 200917 yr 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
April 28, 200917 yr Not sure if Span is valid in html 4.01 strict though.... <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).
April 28, 200917 yr 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.
April 28, 200917 yr ... span also has no real semantic meaning or value whatsoever. That's exactly what I said - in both posts. I give up
April 28, 200917 yr 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 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.
April 28, 200917 yr Author you guys are so funny, who would have known underlining something was going to cause such a discussion
April 28, 200917 yr 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
April 28, 200917 yr 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>
April 28, 200917 yr 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...
April 29, 200917 yr 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 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