...

View Full Version : Increasing point size on just one word in CSS class



Kevin_M_Schafer
05-02-2011, 04:37 PM
When I build a CSS class and use it for several pieces of text on different parts of my page, is there a correct way to increase the point size on just one word?

I know font tags are frowned upon, so I want to learn the right way.

Any help would be greatly appreciated.

abduraooft
05-02-2011, 05:18 PM
is there a correct way to increase the point size on just one word? Just set a different class on it and override the previous style using this.

Kevin_M_Schafer
05-02-2011, 06:00 PM
abduraooft,

Thanks for the reply.

I built a new class for this point size and it will get used often.

Question: Do I que this new class with a div tag or how do I call on it? A div tag wants to knock the following text to a second line.

abduraooft
05-02-2011, 06:12 PM
Question: Do I que this new class with a div tag or how do I call on it? A div tag wants to knock the following text to a second line.
There's something wrong with your understanding. <div> just one , in the list of all tags in html. Besides that, <div> is a block level element (like h1...h6, p, blockquote, ul, li etc.).

To style a specific word or phrase inside a text, you may use a <span>. If the text to be styled has some extra significance in the document, you may use tags like <strong>, <em> etc.

Can we have a link to your page or some of your markup?

Kevin_M_Schafer
05-02-2011, 07:05 PM
abduraooft,

Thanks for your reply. I'm learning this as fast as I can.

Here is my current site: http://www.theeagleextra.com There are 600 + errors and 100 + warnings.

Here is what I'm building now to take its place: http://www.theeagleextra.com/sophie.html

I know it's not correct, I'm atleast trying to do the right thing.

Here's my situation: I'm learning this while I need to use it. Two weeks ago I had a do-it-myself website online hosting template.

I've been in the printing business for over 30 years, and I know composition, I'm just trying to create on the screen what I would want on the sheet -- so to speak.

I no sooner learned html and tables and now I have to throw all of that away and learn CSS. I'm getting it, and with this message board I'm learning it. Please help.

I don't understand why a <p class="0000"></p> or a div tag knocks the following text onto a new line.

Thanks for your time.

AndrewGSW
05-02-2011, 08:24 PM
I don't understand why a <p class="0000"></p> or a div tag knocks the following text onto a new line.
Class names cannot begin with a number, but can contain numbers, letters hyphens or underscores.

Divs are block-level elements by default. That is, they occupy the full width of their parent element and may have paragraph spacing above and/or below them. This spacing can be controlled using css margins and/or padding. (Added: paragraphs p are also block-level elements.)

Spans are inline elements by default. Prefer these for modifying or formatting inline text or other elements.

These are general rules of thumb though, as divs and spans can be modified to behave as either block or inline elements.

Kevin_M_Schafer
05-02-2011, 08:33 PM
Hi Andy,

A question: Okay, if this text is going along and I stop to do this <font-face="verdana">etc . . </font> this is wrong, but if I stop to do this <span font-color="blue">etc . . </span> this is alright?

You said the other day to avoid font tags. I just want to make sure I understand.

Do font tags slow the browser down -- or are they going to be completely phased out someday?

AndrewGSW
05-02-2011, 09:19 PM
The font tag is being phased out and should not be used.

Both of your samples are, unfortunately, invalid:


<span style="color:blue;">Something blue.</span>

This uses an inline style, but you would be better served by creating a stylesheet to define the overall styling of your page/site.

Perhaps this SitePoint (http://blogs.sitepoint.com/css-is-easy/)article will point you in the right direction.

Added: Or refer to the sticky which lists other resources.

Kevin_M_Schafer
05-02-2011, 11:49 PM
Thanks, Andy. I'm going to go ahead and develop classes and call them up using <span>.

I hope this is correct.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum