Professional Documents
Culture Documents
Supriya Chakraborty
AMITY University, Kolkata
Already Covered in CSS
• The different selectors of CSS.
• How to include the separate CSS file?
• What is CSS and advantages of CSS.
Background-color
• The background-color property set the background color
of the element.
With CSS, all three schemes are
body { applicable:
background-color: lightblue;
a valid color name - like "red"
}
a HEX value - like "#ff0000"
Many
creativities
Applied
Fixed Background image, but scroll the above content
• http://localhost/fixedimg.html
• The user experience is different when scroll down.
• Background-position: right top;
• Background-repeat: norepeat;
• Background-attachment: fixed;
Another fixed background
• http://localhost/divfixed.html
Sticky Header
• The sticky header like amazone needs java script.
A very graceful design tool
CSS BORDERS
CSS Borders
• The CSS border properties allow you to specify the style,
width, and color of an element's border.
• The border-style property specifies what kind of border to
display.
Few example
Boarder style and Width
p.one { p.three {
border-style: solid;
border-style: dotted;
border-width: 5px;
} border-width: 2px;
}
p.two {
border-style: solid; p.four {
border-width: medium;
} border-style: dotted;
border-width: thick;
}
Output
Boarder individual side and color
p {
border-top-style: dotted;
border-right-style: solid;
border-bottom-style: dotted;
border-left-style: solid;
}
• The border-radius property is used to add rounded borders
to an element:
p {
border: 2px solid red;
border-radius: 5px;
}
Now to design the following
<!DOCTYPE html>
<head> <style>
P{ border-bottom : solid;
border-bottom-width: 15px;
} </style> </head>
<body>
<p> Astoma Sadgamay, Tamsoma
Jotir Gamyay </p>
</body>
</html>
Vertical Line
Code
<h2>The IT Industry Concerns </h2> • .vl {
<div class="vl"> • border-left: 6px solid red;
• height: 200px;
The probelms is that the off-the-self
• position: absolute;
modules are not built and
shortterm profits are not gained • left: 50%;
for the last few years. • margin-left: 3px;
• top: 10;
</div> • }
CSS Margins
• The CSS margin properties are used to create space around
elements, outside of any defined borders.
CSS has properties for specifying the margin for each side of an element:
• margin-top
• margin-right
• margin-bottom
• margin-left
Unit of values of Margin
• auto - the browser calculates the margin
• length - specifies a margin in px, pt, cm, etc.
• % - specifies a margin in % of the width of the containing
element
• inherit - specifies that the margin should be inherited from
the parent element
#v1 {
margin-top: 100px;
margin-bottom: 100px;
margin-right: 150px;
margin-left: 80px; /* 902- 150 = 752 is the width of the div of v1 */
background-color: #E5E4E2;
borders.
Individual Sides for Padding
CSS has properties for specifying the padding for each side of
an element:
• padding-top
• padding-right
• padding-bottom
• padding-left
Undesired Result – Padding and width
• The CSS width property specifies the width of the
element's content area. The content area is the portion
inside the padding, border, and margin of an element
div {
width: 300px; Div total width = 300+
padding: 25px; 25 = 325 px.
}
Box-sizing: The solution of the undesired result