Professional Documents
Culture Documents
CSS Notes Infinity1
CSS Notes Infinity1
CSS stands for Cascading Style Sheets and it describes, how HTML elements are to be displayed on
screen or in other media, it saves lot of work and time as well as we can control the layout of multiple
web pages all at once.
Coding in mystyle.css
body {
background‐color: yellow;
}
h1
{
color:red;
font‐family:verdana;
font‐size:300%;
}
P
{
color:red;
font‐family:courier;
font‐size:160%;
}
ID ATTRIBUTE
To define a specific style for one element, add an ID attribute to the element.
Example of ID attribute
<p ID="p01">I am different</p>
ID definition
#p01 {
color: blue;
}
Note: The id of an element should be unique within a page, so the id selector is used to select one
unique element!
CLASS ATTRIBUTE
To define a style for a special type of elements, add a class attributes to the
element:
Class Definition
p.error {
color: red;
}
External Reference
External style sheets can be referenced with a full URL or with a path relative to
the current web page.
Example of External Reference attribute
<link rel="stylesheet" href="https://www.infinity.com/html/styles.css">
This example links to a style sheet located in the html folder on the current web
site:
<link rel="stylesheet" href="/html/styles.css">
Links
<style>
a:link {
color: green;
background‐color: transparent;
text‐decoration: none;
}
a:visited {
color: pink;
background‐color: transparent;
text‐decoration: none;
}
a:hover {
color: red;
background‐color: transparent;
text‐decoration: underline;
}
a:active {
color: yellow;
background‐color: transparent;
text‐decoration: underline;
}
</style>
Links Attributes
The target attribute specifies where to open the linked document.
Eg 1:
<a href="https://www.infinity.com/" target="_blank">Visit Infinity Computers</a>
<a href="https://www.infinity.com/html/" target="_top">HTML5 tutorial!</a>
Eg 2:
<a href="default.asp">
<img src="smiley.gif" alt="HTML tutorial" style="width:42px;height:42px;border:0;">
</a>
Book Mark
<h2 id="C4">Chapter 4</h2>
Images
HTML LAYOUT STYLES
Web pages displayed as multi columns using HTML5 and its syntax as:
HEADER
NAV
SECTION
ASIDE
ARTICLE
FOOTER