If you have to give same look and feel to many pages then it is a good idea to keep all the style sheet rules in a single style sheet file and include this file in all the HTML pages. You can include a style sheet file into HTML document using <link> element. Below is an example.
<head>
<link rel=”stylesheet” type=”text/css” href=”yourstyle.css”>
</head>
If you want to apply style sheet rules to a single document only then you can include those rules into that document only. Below is an example :
<head>
<style type=”text/css”>
body { background-color: pink; }
p{color:blue;20px;font-size:24px}
</style>
</head>
You can apply style sheet rules directly to any HTML elemet. This should be done only when you are interested to make a particular change in any HTML element only. To use inline styles you use the style attribute in the relevant tag. Below is an example:
<p style=”color:red;font-size:24px;”>Using Style Sheet Rules</p>
You liked the article?
Like: 0
Vote for difficulty
Current difficulty (Avg): Medium
TekSlate is the best online training provider in delivering world-class IT skills to individuals and corporates from all parts of the globe. We are proven experts in accumulating every need of an IT skills upgrade aspirant and have delivered excellent services. We aim to bring you all the essentials to learn and master new technologies in the market with our articles, blogs, and videos. Build your career success with us, enhancing most in-demand skills in the market.