Border using CSS in html file
BORDER AND BACKGROUND USING EXTERNEL CSS FILE IN HTML.
There are 4 property of border :
1.border-width:
(give width in px)
for example :
border-width:5px;
2.border-style:(required)
(there are too many value for border-style property)
solid
dotted
dashed
double
inset
outset
3.border-color:
give color name (red)
or HEX value ( #fff)
or rgb ( , , ) values for color.
We use shorthand property to give border to any object.
border: width style color;
Background have mainly 4 value :
1.background-color :
give color name (red)
or HEX value ( #fff)
or rgb ( , , ) values.
or hsl( , , ) values.
2.background-image :
background-image:url("");
/* type name or path in breckets */
3.background-attchment:
background-attchment:fixed;
4.background-repeat :
values:
repeat x ----for repeat only horizontally
repeat y ----for repeat only vertically
repeat ------to repeat on both vertically and horizontally
no-repeat ----- the background image is not repeated.
Example for border and background :
First create the html file and insert any object image or paragraph on which you want border and type the code given below :
<!DOCTYPE html>
<html>
<head>
<title> Assignment-1 </title>
<link rel="stylesheet" type="text/css" href="___">
<!-- in blank type your css file name with .css extention or path if file is not in same folder -->
</head>
<body>
<img src="____" width=500 height=500 >
<!-- in blank type your image name with extension or path if file is not in same folder-->
</body>
</html>
Now, create the .css extention file for border and background color and type the code given below :
body
{
background:red;
}
img
{
border:5px solid blue ;
/* this is shorthand property of border 1.width of border 2.style of border 3.color of border */
}
Now run the html file in chrome or any browser ....
There are 4 property of border :
1.border-width:
(give width in px)
for example :
border-width:5px;
2.border-style:(required)
(there are too many value for border-style property)
solid
dotted
dashed
double
inset
outset
3.border-color:
give color name (red)
or HEX value ( #fff)
or rgb ( , , ) values for color.
We use shorthand property to give border to any object.
border: width style color;
Background have mainly 4 value :
1.background-color :
give color name (red)
or HEX value ( #fff)
or rgb ( , , ) values.
or hsl( , , ) values.
2.background-image :
background-image:url("");
/* type name or path in breckets */
3.background-attchment:
background-attchment:fixed;
4.background-repeat :
values:
repeat x ----for repeat only horizontally
repeat y ----for repeat only vertically
repeat ------to repeat on both vertically and horizontally
no-repeat ----- the background image is not repeated.
Example for border and background :
First create the html file and insert any object image or paragraph on which you want border and type the code given below :
<!DOCTYPE html>
<html>
<head>
<title> Assignment-1 </title>
<link rel="stylesheet" type="text/css" href="___">
<!-- in blank type your css file name with .css extention or path if file is not in same folder -->
</head>
<body>
<img src="____" width=500 height=500 >
<!-- in blank type your image name with extension or path if file is not in same folder-->
</body>
</html>
Now, create the .css extention file for border and background color and type the code given below :
body
{
background:red;
}
img
{
border:5px solid blue ;
/* this is shorthand property of border 1.width of border 2.style of border 3.color of border */
}
Now run the html file in chrome or any browser ....
Comments
Post a Comment