Color, Margins, Padding & Border Properties
Color, Margins, Padding & Border Properties
Example:
<html>
<head>
<style>
h1
{
color: #0000ff;
background-color: cyan;
border-style: solid;
border-color: rgb(255,0,0);
}
</style>
</head>
<body>
<h1>Hyper Text Markup Language</h1>
</body>
</html>
Margins:
The space between screen & border is called as margin.
Margin Properties:
1) margin-top => It is used to specify the top margin.
2) margin-right => It is used to specify the right margin.
3) margin-bottom => It is used to specify the bottom margin.
4) margin-left => It is used to specify the left margin.
5) margin => It is used to specify margin at all sides.
Padding:
The space between content & border is called as padding.
Padding Properties:
1) padding-top => It is used to specify the top padding.
2) padding-right => It is used to specify the right padding.
3) padding-bottom => It is used to specify the bottom padding.
4) padding-left => It is used to specify the left padding.
5) padding => It is used to specify the padding at all sides.
Border Properties:
1) border-style => It is used to specify the style of the border.
The following values can be used.
1) solid 2) dashed 3) dotted 4) double 5) none
2) border-width => It is used to specify the border thickness.
3) border-color => It is used to specify the border color.
Example:
<html>
<head>
<style>
body
{
background-color: cyan;
}
div
{
color: blue;
background-color: yellow;
border-style: dotted;
border-color: red;
width: 430px;
height: 250px;
margin-left: 100px;
margin-top: 100px;
padding-top: 50px;
padding-left: 100px;
padding-right: 100px;
border-width: 15px;
}
</style>
</head>
<body>
<div>
<h1>Hyper Text Markup Language</h1>
<h1>Cascading Style Sheets</h1>
<h1>Java Script</h1>
</div>
</body></html>
Border Properties:
1) border-style => solid (or) dashed (or) dotted (or) double (or) none
2) border-width => 5px (or) 10px (or) .....
3) border-color => red (or) green (or) blue (or) ......
4) border-radius => It is used to display rounded borders.
5) border-top-style
6) border-right-style
7) border-bottom-style
8) border-left-style
9) border-top-width
10) border-right-width
11) border-bottom-width
12) border-left-width
13) border-top-color
14) border-right-color
15) border-bottom-color
16) border-left-color
17) border-top-left-radius
18) border-top-right-radius
19) border-bottom-left-radius
20) border-bottom-right-radius
21) border-top
22) border-right
23) border-bottom
24) border-left
25) border
Example:
<html><head><style>
body
{
background-color: yellow;
}
div
{
color: blue;
border-style: solid;
border-color: red;
border-top-right-radius: 100px;
border-bottom-left-radius: 100px;
width: 250px;
height: 250px;
padding-top: 50px;
padding-left: 50px;
margin-top: 50px;
margin-left: 50px;
background-color: cyan;
}
</style></head><body>
<div>
<h1>HTML</h1>
<h1>CSS</h1>
<h1>Java Script</h1>
</div>
</body></html>
border-width: 10px;
}
img
{
width: 150px;
height: 150px;
}
#one
{
border-style: solid;
border-width: 3px;
border-color: red;
border-radius: 100px;
}
#two
{
border-style: dashed;
border-width: 3px;
border-color: green;
border-radius: 40px;
}
#three
{
border-style: dotted;
border-width: 3px;
border-color: blue;
border-radius: 50%;
}
</style>
</head>
<body>
<div>
<img id="one" src="C:/flowers.jfif">
<img id="two" src="E:/pinkroses.jpeg">
<img id="three" src="E:/roses.jpg">
</div>
</body>
</html>
By