A bit of CSS for HTML

CSS is a  Markup Language, like HTML. HTML is used to make a document Structure and CSS is used to make the document style. You can learn CSS in the CSS Course, but anyway you’ll learn a bit of CSS in the HTML course, It’s necessary and usfeul.

However the CSS shown in HTML course is just basic CSS.

There are 3 ways to insert CSS in a HTML document, in this chapter will be shown just one, the most simple and limited.

You know <p></p> is a paragraph, you can insert CSS like this:

<p style=”color:red;”>Text</p>
You will see this:

Text

Then, you can change “red” for any color: blue; yellow, white… The color are limited but there is a way to chose a color range using RGB but that will be show in other chapters.

You can do the following:

<p style=”border: solid black 1px;>Text</p>

You will see this:

Text

And like “solid black” is used you can use “solid green”, or any other.

The attribute “color” can be changed by “background-color”, this will change the background color.

The structure is the following: <tag style=”attribute:value;”>Content</tag>

You can see the semicolons, the syntax must be exctly the same or the style will be not shown.

I invite you to play with CSS in other tags like <he>, <h1></h1> and others!

Other thing you can do with the style is:

<p style=”font-size:200%;”>Text</p>

You will see this:

Text

You can see how you can change the text size easily. Another thing you can make is align the text, to see it best I will use a border attribute too:

<p style=”border:solid black 2px; text-align:center;”>Text</p>

You will see this:

Text

Then try to change the value “center” for “right” or others.

You can see the CSS is so intuitive like HTML.

Last example:

Change the text font:

<p style=”font-family:verdana”>Text</p>

You will see this:

Text

Practice It yourself to follow with the next chapter!


Posted

in

by

Tags:

Comments

Leave a Reply