Unit - 4
Unit - 4
Unit - 4
Defining styles - elements of styles - linking the style sheet - in-line style
External style sheets - internal style sheets and inline style sheet.
CSS
CSS stands for Cascading Style Sheets.
CSS saves a lot of work. It can control the layout of multiple
web pages all at once.
Cascading Style Sheets (CSS) is used to format the layout of a
webpage.
With CSS, we can control the color, font, the size of text, the
spacing between elements, how elements are positioned and
laid out, what background images or background colors are to
be used, different displays for different devices and screen
sizes, and much more!
Using CSS
CSS can be added to HTML documents in 3 ways:
The following example sets the text color of the <h1> element to blue, and the text
color of the <p> element to red:
CSS Border
<html>
<head>
The CSS border property defines a border around an HTML <style>
element. p{
border: 2px solid powderblue;
We can define a border for nearly all HTML elements.
}
</style>
</head>
p { <body>
border: 2px solid powderblue;
} <h1>This is a heading</h1>
<p>This is a paragraph.</p>
<p>This is a paragraph.</p>
<p>This is a paragraph.</p>
</body>
</html>
<!DOCTYPE html>
<html>
CSS Padding <head>
<style>
The CSS padding property defines a padding p{
(space) between the text and the border. border: 2px solid powderblue;
padding: 30px;
}
p {
</style>
border: 2px solid powderblue;
</head>
padding: 30px;
<body>
}
<h1>This is a heading</h1>
<p>This is a paragraph.</p>
<p>This is a paragraph.</p>
<p>This is a paragraph.</p>
</body>
</html>