homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor 2014
Home / Forums Index / Code, Content, and Presentation / HTML
Forum Library, Charter, Moderators: incrediBILL

HTML Forum

What Tag to Use for an ID

 8:38 pm on Mar 5, 2012 (gmt 0)

I have a long line of text, and I want to ID just part of it so that I can change that part of the text with a function.

My code works fine:

<p class='Text'><var id='count'>ChangeThis</var>... more text I don't want to change

and I change ChangeThis with:


As I say the code works fine, but it's causing the text to be Italic. All the tags I have tried affect the appearance of the text.

It would be easy if I wanted to change all the text as I could simply put the ID in the <p>. But I only want to change some of the text inside the <p>.

What tag can I use to isolate the text I want to change? <var> makes it Italic.

Thank you, Peter



 8:50 pm on Mar 5, 2012 (gmt 0)

<span> ... </span>

 9:01 pm on Mar 5, 2012 (gmt 0)

Great! Thanks.


 3:18 am on Mar 6, 2012 (gmt 0)

Or redefine var in your css.


 4:46 am on Mar 6, 2012 (gmt 0)


I tried putting class='whatever' in the var tag and styling it with CSS that way. But it didn't work.

Or I guess I could have done an in-line style.

Anyway, span worked perfectly.



 7:56 am on Mar 6, 2012 (gmt 0)

HTML used to be ugly and confusing. The mix of semantic and presentation types of tags and attributes wasn't all that logical.

If you now use CSS, the HTML part is so much easier. You need to know what goes in <head>, such as charset declaration, title, meta description, links to css files, links to js files, and what goes in <body>, such as headings, paragraphs, lists, tables, forms, clickable links, links to images, and how to use <div> and <span>. With those you have just about all the HTML you'll ever need.


 9:14 am on Mar 6, 2012 (gmt 0)

Did you say {font-style: normal} ? It isn't enough to add styles; you have to override the default. I do it often with <em>.

Incidentally, I think <var> is intended to be used for mathematical variables. That's why they're normally italicized. Not to text that you're planning on changing. There's no html tag for that, since the change isn't an html (or even css) action.

Global Options:
 top home search open messages active posts  

Home / Forums Index / Code, Content, and Presentation / HTML
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved