Jump to content

tag question...


straightryder

Recommended Posts

If i have a

or a .class can i style a certain part in the paragraph as such below...

 

html below would be something like:

 

blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah 20% since the crisis began. "Customers who used to come to us three times a week now limit themselves to once a week. blah blah blah blah blah blah blah blah

 

Then go to the CSS and do something like:

 

large {

color:red;

font-size:18px;

}

 

Is this a safe technique? Sorry, I'm just new to CSS and hope I'm not asking stupid questions.

 

Thanks

Link to comment
Share on other sites

You can't create your own tag like that... you need to stick to existing tags: div, span, etc...

 

You could give a div or a span a classt though, doing something like this (which you may have meant, but just typed your example out wrong, I'm not sure):

 

blah blah blah... large text here... blah blah blah.

 

and the css:

 

.large { color:red; font-size:18px; }

Link to comment
Share on other sites

falken thanks...

 

I got into a disagreement with another friend who is starting out in css an' told me its safe to do that because the browser recognizes it. After look around this site i came across http://www.cssbasics.com/css-spans/ and thought this was the right way.

 

 

Now i can rub my friends face in the dirt. Thanks!!

Link to comment
Share on other sites

Just for your info, there are experts who say they (and you) should never use a span tag, although I can't remember the reason why they say that. I think it's because there is always a more specific and appropriate tag, whereas span is a very general all-purpose tag and they think it will be deprecated, or ought to be deprecated, although I don't think that is going to happen any time soon.

 

In that instance they would use the ... tag, either on its own where it is italic by default or you could change the style for the em tag or you could use a class with the em tag

...

 

em is for emphasis and screen readers will tell a blind person that the text has emphasis even though they cannot see the larger or italic or red text or whatever style you have given it, whereas span doesn't carry emphasis to a blind person.

 

Similarly,

The ... and ... tags are purely visual so use these for thicker or italic text where you want it to look different on the screen, possibly for large sections of text or even a whole page, where the text is not more important.

 

The ... and ... tags have special features to help disabled viewers, especially screen readers where different emphasis is given; so only use these tags where single words or short sections of text need emphasis.

Edited by Wickham
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...