Hi..
What are the different ways of applying CSS in HTML ?
thanks
Different ways of applying CSS in HTML
Hi..
What are the different ways of applying CSS in HTML ?
thanks
applying css in html
&nsbp;
#2
Posted 30 July 2012 - 11:26 AM
Different ways of applying CSS in HTML
1.In-line style
In-line styles plonk straight into the HTML tags with the style attribute.
Ex.
<p style="color: blue">text</p>
This will make the paragraph blue.
2.Internal style
internal or embedded styles are used for the entire page. Inside the style tags, the Head tags surrounding all of the pages styles.
External
External styles are used for all the pages in a website and it’s code is placed in a separate CSS file, ex.
p {
color: blue;
}
a {
color: red;
}
This file should be saved as "web.css" and then we can link it to the HTML like this:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.abc.net/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<title>CSS ex</title>
<link rel="stylesheet" type="text/css" href="web.css" />
1.In-line style
In-line styles plonk straight into the HTML tags with the style attribute.
Ex.
<p style="color: blue">text</p>
This will make the paragraph blue.
2.Internal style
internal or embedded styles are used for the entire page. Inside the style tags, the Head tags surrounding all of the pages styles.
External
External styles are used for all the pages in a website and it’s code is placed in a separate CSS file, ex.
p {
color: blue;
}
a {
color: red;
}
This file should be saved as "web.css" and then we can link it to the HTML like this:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.abc.net/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<title>CSS ex</title>
<link rel="stylesheet" type="text/css" href="web.css" />
#3
Posted 01 August 2012 - 05:35 PM
there are 3 ways:
<h1 style="font-size:2.5em;font-weight:bold;color:#990000;">Sample
Headline</h1>
<link rel="stylesheet" href="style.css" media="screen" />
<style>
h1 {font-size:1.5em; color:#990000;}
p {font-size:.9em; line-height:140%;color:#000000;}
</style>
<h1 style="font-size:2.5em;font-weight:bold;color:#990000;">Sample
Headline</h1>
<link rel="stylesheet" href="style.css" media="screen" />
<style>
h1 {font-size:1.5em; color:#990000;}
p {font-size:.9em; line-height:140%;color:#000000;}
</style>
Also tagged with one or more of these keywords: applying css in html
General chat →
Introduce Yourself →
newbieStarted by Guest_septembre_*, 06 Feb 2013 applying css in html |
|
|
2 user(s) are reading this topic
0 members, 2 guests, 0 anonymous users