Use Of CSS in HTML


CSS (Cascading Style Sheets) is a style sheet language used to style document or webpage written in HTML and XHTML. It can also be applied to XML document. CSS is used to separate the design and other presentation logic in HTML. In our blog today we will use internal CSS to add style to our HTML.

As the comments in the code suggest we start with our HTML head and define style as text/css. We define various styles for standard elements like p and for other new entities like strip1 and strip2. They have their width and height and background color. Now we will use the elements defined in the CSS in our HTML body.

We have drawn strip 1 and strip 2. We also use the p tag for the paragraph. Output will be the following