HTML CSS

CSS(Cascading Style Sheet ) is used to style the html elements.
Now a days CSS plays a very important role to design the webpage and the whole sites  and if you know the html and css you can create and design the whole Static Site.CSS save our time with respect to html.

Example:

<html>
<body style="background-color:Aliceblue;">

<h1>Here! Styles and colors</h1>

<p style="font-family:verdana;color:red;">
This text is in Verdana and red</p>

<p style="font-family:times;color:green;">
And this text is in Times and green</p>

<p style="font-size:30px;">And this text is 30 pixels </p>

</body>
</html>
  



Your Result:




How To Style HTML With CSS

Basically CSS was introduced together with HTML 4,to style the HTML elements in better way.
We can add CSS to HTML in the following ways:

  1. Inline- In this method we use the Style attribute in HTML elements.
  2. Internal-In this method we use the <style> element between the <head> tags.
  3. External- In this method we use an External CSS file.
In the above methods ,method 3 is commonly use .Here is the example of point 3.

External Style Sheet

<html>
<head>
<link rel="stylesheet" type="text/css" href="styles.css"/>
</head>
<body>
<h1>Here is the example of external style sheet</h1>
<p>Me too!</p>
</body>
</html>


In HTML we save the file as .html,and when we write the CSS file we save the file as style.css

But in this tutorial we use the CSS to style the html elements and further we learn about the CSS in the CSS Tutorials.

Internal Style Sheet
Internal Style Sheet is defined full in the <head> tags  and for  internal style sheet we do not any need to save the file separately.Here is the example;


Example:

<head>
<style type="text/css">
body{background-color:red;}

</style>
</head>


HTML Style Example Using CSS -Font,Color and Size

Here we use the CSS to change the size,font and color of html elements.
here is the example;
Example:

<body>
     <html>
<body>
<h1 style="font-family:verdana;">A  Heading</h1>
<p style="font-family:arial;color:blue;font-size:25px;">A Paragraph.</p>
</body>
</html>

</body>


Your Result:
And here is the result in web browser.


that's all if you have any problem  then please happily Contact Us.

No comments:

Post a Comment