Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/mislz28/public_html/wp-content/themes/css-faq-v2/timeweather/timeweather.php on line 19
  • Uncategorized
25 February 2008

Using style attributes within CSS

The first thing you need to do within CSS to add a style attribute is to declare it within an already existing HTML tag. To do this effectively you have to add this to an HTML tag:

“ “

So if you were to see this, this is how it would look:

“style:attribute”.

“color:green”.

You can see that there is a colon in-between the words color and green. Neither an equal sign nor any extra quote marks.

So now you have your CSS attribute ready you now have to insert it into a HTML tag. You would specifically enter it into the <DIV> tag. DIV actually stands for the division in the web page. Always remember to close the tag after you have finished with your green text, otherwise you will have an abundance of green on your page!

So it will overall look like this:

<DIV style=”color:green”>Look at all the green writing!</DIV>

So it will end up looking like this:

Look at all the green writing!

So what do you do if you want another attribute applying to same piece of text? Well, quite simply after the first attribute which in this case is the color, add a semi colon and then keep adding semi colons depending on how many attributes you would like. So if you wanted your text to be not only green but italic, then you would do the following:

<DIV style=”color:green; font-style:italic”>Look at all the green writing!</DIV>

So you can now see what this adds up to with your text:

Look at all the green writing!

So each time you want to add a new property to your text then you just add a semi colon. So if you wanted your text to not only be green and italic, but also bold, then you would do the following:

<DIV style=”color:green; font-style:italic; font-weight:bold”>Look at all the green writing!</DIV>

You would end up with this:

Look at all the green writing!

So you can now see how it can be done by adding different properties to your text each time you want to change something. It may seem confusing with all the different attributes, but it doesn’t have to be difficult at all.

If you get stuck there are many guides to refer to and once you get the hang of using CSS you will love the versatility it gives you and your designs.

This entry was posted on 25 February 2008 at 10:36 PM and is filed under Uncategorized. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

Leave a reply

Name (*)
Mail (will not be published) (*)
URI
Comment