To add a style attribute in CSS, you first need to declare a specific attribute within a pre-existing HTML tag. Add this to the HTML tag “ “ for the attribute to take effect. This is how it should appear:
“style:attribute”.
To make it more simple, if you wish to convert your text color to green, use the following rule:
“color:green”.
Observe the placement of a colon in-between the words color and green. Note the absence of an equal sign or extra quote marks.
Once you have prepared this attribute, you could then insert it into the HTML tag, more specifically the <DIV> tag. DIV, in essence, stands for a web page’s division. It is important to always close the tag after you have finished inserting your green text. All the text on your page will turn green if you fail to do so.
The overall appearance of the CSS should look like the following:
<DIV style=”color:green”>Look at all the green writing!</DIV>
So what step do you take if you want to apply another attribute to the very same text portion? All you need to do is add a semi-colon and another and so on, depending on how many attributes you would like to add. For example, to make your text appear green and italicized, use the following rule/s:
<DIV style=”color:green; font-style:italic”>Look at all the green writing!</DIV>
So remember, just add a semi-colon to apply additional attributes to your text. If say, you want to turn your green-colored, italicized text into boldface, just use the following:
<DIV style=”color:green; font-style:italic; font-weight:bold”>Look at all the green writing!</DIV>
Now you have the know-how on applying attributes by simply adding different properties on the text you want to change. It might take a little time to get used to the process but be assured that it is not complicated at all.
In case you need further assistance, do not hesitate to consult CSS guides - there are many of them available online and in the market. Once you get the hang of it, you will be pleased with the wide range of flexibility offered by CSS.



english
español
Deutsch
français
Italiano
Português
русский










Leave a reply