Unit-2.3 CSS
Unit-2.3 CSS
Prepared by
Dr Komarasamy G
Associate Professor (Grade-2)
School of Computing Science and Engineering
VIT Bhopal University
Unit-2 HTML and CSS
HTML5 Basics – Formatting – Colors – Images
– Links – Tables – Lists – Layout –
Forms–Canvas –Media.
CSS3 Basics – Selectors - Box Model -
Backgrounds and Borders -Text Effects –
Advanced Features.
p{
<html>
font-family: verdana;
<head>
font-size: 20px;
<style>
}
body {
</style>
background-color: lightblue;
</head>
}
<body>
<h1>My First CSS Example</h1>
h1 {
<p>This is a paragraph.</p>
color: white;
</body>
text-align: center;
</html>
}
background-color
CSS background properties: Example
• background-color body {
background-color: lightblue;
• background-image }
• background-repeat With CSS, a color is most often specified by:
• background-attachment a valid color name - like "red"
a HEX value - like "#ff0000"
• background-position an RGB value - like "rgb(255,0,0)"
https://www.w3schools.com/css/css_background.asp
More Details:
https://www.w3schools.com/css/css_background.asp
</body>
</html>
</body>
</html>
<h2>The border-bottom
Property</h2>
<p> bottom-color.</p>
</body>
</html>
p.round3 {
border: 2px solid red;
border-radius: 12px;
}
</style>
Unit-2 CSS / Dr Komarasamy G 27
CSS –borders – More Examples
https://www.w3schools.com/css/css_attribute_selectors.asp
Unit-2 CSS / Dr Komarasamy G 30
Embedding CSS to Html
External CSS
• An external style sheet is used to define the style for many HTML pages.
File Name: "styles.css”:
body {
background-color: powderblue;
}
h1 {
color: blue;
} <html>
p{ <head>
color: red; <link rel="stylesheet" href="styles.css">
</head>
}
<body>
<h1>This is a heading</h1>
<p>This is a paragraph.</p>
</body>
</html>
Unit-2 CSS / Dr Komarasamy G 33
CSS - Formatting fonts
• The CSS color property defines the text color to be used.
• The CSS font-family property defines the font to be used.
• The CSS font-size property defines the text size to be used.