HTML-CSS
HTML-CSS
What is CSS?
CSS stands for Cascading Style Sheets.
There are different levels to CSS: CSS; CSS 2; CSS 3. This has
been confusing for developers and browsers. One language is
preferred.
Difference between HTML & CSS
SYNTAX OF CSS
CSS declarations rest within curly brackets, and each consist of two
parts: property and its value, separated by a colon.
Selector{property: value;}
SYNTAX OF CSS
You can define numerous properties in one
declaration, each separated by a semi-colon.
TYPES OF CSS
<html> h1 {
<head> color: red;
<link rel="stylesheet" href="hello.css"> font-size:100px;
</head> font-family:"Jokerman";
<body> }
<h1>NISHA</h1>
p{
<p>CASCADING STYLE SHEET</p>
color: blue;
</body>
font-size:50px;
</html>
font-family:"forte";
}
FONT PROPERTIES
COLOR
BACKGROUND-COLOR
FONT-FAMILY
FONT-SIZE
FONT-STYLE (Normal, Italic, Oblique)
The border-style property can have from one to four values (for the top border,
right border, bottom border, and the left border).
BORDER PROPERTIES
BORDER PROPERTIES
border-style: dotted solid double dashed; Border-color : red green yellow blue;
top border is dotted
top border is red
right border is solid
bottom border is double right border is green
left border is dashed bottom border is yellow
left border is blue
border-style: dotted solid double;
top border is dotted Border-color : red green yellow;
right and left borders are solid top border is red
bottom border is double
right and left borders are green
border-style: dotted solid; bottom border is yellow
top and bottom borders are dotted Border-color : red green;
right and left borders are solid
top and bottom borders are red
border-style: dotted; right and left borders are green
all four borders are dotted Border-color : red;
all four borders are red
Border: green 20px dotted;
HEIGHT & WIDTH PROPERTIES
The height property sets the height of an element.
If height: auto; the element will automatically adjust its height to allow its
content to be displayed correctly.
If height is set to a numeric value (like pixels, percentages) then if the content
does not fit within the specified height, it will overflow.
height: auto;
height: 100px;
height: 50%;
The width property sets the width of an element.
width: auto;
width: 100px;
width: 50%;
OUTLINE PROPERTIES
CSS has the following outline properties:
outline-style
outline-color
outline-width
outline-offset
outline
OUTLINE PROPERTIES
CSS Outline Style
The outline-style property specifies the style of the outline, and can have one of the
following values:
dotted - Defines a dotted outline
dashed - Defines a dashed outline
solid - Defines a solid outline
double - Defines a double outline
groove - Defines a 3D grooved outline
ridge - Defines a 3D ridged outline
inset - Defines a 3D inset outline
outset - Defines a 3D outset outline
none - Defines no outline
hidden - Defines a hidden outline
OUTLINE PROPERTIES
outline-color:red;
outline-style:dotted;
outline-width:20px;
outline-offset:15px; (space between border and
outline)
outline: red dotted 20px 15px;
Align & Float PROPERTIES
The text-align property specifies the horizontal
alignment of text in an element.
<html>
<style>
Body
{
background-image: url("/uploads/media/default/0001/02/55a2f152f59bf42a99b576d44a4578ec9daa0ab6.png");
(Image will be added to the webpage)
background-color: red; (background color of the webpage will be changed to red)
background-attachment: fixed;(Image will be fixed even if you scroll up and down)
background-repeat: no-repeat; (background image will not be repeated)
}
</style>
<body>
<h2>Background-image property example</h2>
<p>Hello World!</p>
</body>
</html>