Introduction to CSS
What is CSS?
Cascading: Multiple styles can overlap in order to specify a range of style from a whole web site down to a unique element. Which style gets applied pertains to the rules of CSS cascading logic.
Style: CSS deals specifically with the Presentation domain of designing a web page (color, font, layout, etc).
Sheet: Normally, CSS is a file separate from the HTML file –linked to the HTML file through its <head> (exceptions apply).
Why CSS?
Allows for much richer document appearances than HTML.
Reduce workload by centralizing commands for visual appearance instead of scattered throughout the HTML doc.
- Use same style on multiple pages.
- Reduce page download size.
Basic Syntax
Made up of three parts:
selector {property: value}
The selector is normally the HTML element/tag you wish to define
The property is the attribute you wish to change Every property has the value If the value is multiple words, put quotes around the value
p {font-family: "sans serif"}
To make the style definitions more readable, you can describe one property on each line
p
{
text-align: center;
color: black;
font-family: arial
}
Reference CSS from HTML
Inline style
• inside an HTML element
Internal style sheet
• inside the <head> </head>tag
External style sheet
• inside external *.css file
Qus. 1 : ____________ is used to add special effects to a website, such as animation, or hover effects.
- CSS
- PHP
- Javascript
- HTML
- It is a browser determined positioning
- It uses the position property of CSS ,Used to define absolute positioning
- It gives authors greater control on how elements are displayed
- none of the above statements are Correct