CSS is nothing but Cascading Style Sheets, these are used to separate the content from design of the HTML page, so that in future if we want to change the design and layout of the HTML page, without disturbing the content, it will become any easy job. That is we can change the layout / design by simply modifying the CSS.
The CSS can be declared with in the html file or in a separate CSS file.
The structure of the simple CSS is as follows,
.leftcol
{
float: left;
width: 33%;
background:#908800;
}
.middlecol
{
float: left;
width: 34%;
background:#effefe;
}
.rightcol
{
float:left;
width: 33%;
background:#dddd11;
}
In the above example the "leftcol","middlecol","rightcol" are the css class names, which defines its own styling, these classes need to be applied on the HTML elements to see these styling effects.
simple html that uses the above declared css class
<html>
<head>
<style type="text/css">
.leftcol
{
float: left;
width: 33%;
background:#908800;
}
.middlecol
{
float: left;
width: 34%;
background:#effefe;
}
.rightcol
{
float:left;
width: 33%;
background:#dddd11;
}
</style>
</head>
<body>
<div class="leftcol">this is a left div ...</div>
<div class="middlecol">this is a middle div ...</div>
<div class="rightcol">this is a right div ...</div>
</body>
</html>
0 Comments:
Post a Comment