adsense


Sunday, 4 October 2015

TYPES OF CSS STYLE SHEETS PAGE 2


TYPES OF CSS STYLES SHEETS


There are three types of style sheets to insert.
1.inline style sheets
2.Embedded /internal style sheets
3. External style sheets.
1.inline style sheets: These are used to apply a style to a specific element in a webpage with ‘style’ attribute.
Example 2:

<html>
<head>
<title>inline style</title>
</head>
<body>
<h1 style="color: blue; font-family: verdana;"> Example of inline style</h1>
<hr /> <div style="color: red; font-family: arial;"> An inline style loses many of the advantages of style sheets by mixing content with presentation. Use this method sparingly.</div>
</body>
</html>
2. Internal/embedded Style Sheet: Embedded style sheet is a set of styles which is created as a part of an Html file. Advantage: It is useful to apply same styles to all the elements on a web page. These are added in <head> element using <style> element. Style attributes: dir, disabled, media, title,type,lang. Example:3 <html>
<head>
<title>embed style</title>
</head>
<style type="text/css"> body {font: 10pt "Times"} h1 {font: 15pt/17pt "arial"; font-weight:bold; color: maroon} h2 {font: 13pt/15pt "times new roman"; font-weight:bold; color: blue} p {font: 10pt/12pt "algerian"; color: green} </style> <body> <h1> Meditation means now and here</h1> <h2>be with your breath</h2> An internal style sheet should be used when a single document has a unique style. You define internal styles in the head section of an HTML page, by using the <style> tag</p> </body>
</html> 3. External Style Sheet: An external style sheet is a separate file which contains css rules .with this file, we can apply uniform style to one or more web pages using <link> element. Example: <body> {background-color:yellow;font-family:arial} a:link{color:#ffff00} a:visited {color:#808080} a:hover{color:#ff0000} a:active {color:#00ff00} </body> note: save it as xstyle.css linking html document to style sheet: Example :4 <html> <head> <title>external style sheet>/title> <link rel=”stylesheet” href =”d:\\css\xstyle.css”> </head> <body> <h1>example for external style sheet</h1> <a href=d:\\htmldemo\hyper.html target= “_blank”> <h2>hyper link</h2> <a href=d:\\htmldemo\des.html target= “_blank”> <h2>text link</h2> </body> </html>

No comments: