CSS Cascading Style Sheets. CSS Define style, look and presentation of the website content The way the content is presented on the page is determined in presentation rules in a style sheet layout background fonts margins. CSS HTML is used to create logical structure of the content
Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.
Define style, look and presentation of the website content
The way the content is presented on the page is
determined in presentation rules in a style sheet
is used to create logical structure of the content
is used to style the structured content
reside in a separate style sheet file (.css)
located inside individual page within <style> tags inside the document’s <head>
located within HTML tags themselves and only apply to the content of that tag
There are rules to determine which style takes
precedence while multiple styles can cover a single
element of the page.
When style rules conflict, the laws of
the cascade determine how the conflict is settled.
The order of the cascade
The closer a rule to the element getting styled, the more power the rule has in the battle of conflicting style rules.
The order of the cascade
A style rule begins with a selector.
Selector can be a
Redefining the style for a tag gives considerable control,
as HTML has a tag for nearly any type of text you need to
Style rule for something that does not have tag as
Custom name for a style when you create a class.
Do not create classes for something that has a logical tag, like heading <h1, h2, h3, etc>You can simply redefine one of the heading tags.
HTML is used to create logical structure of the content
CSS used to style the structured content
Class is reusable
Many different elements on a page can be assigned to the
Class has a name
A period (.) precedes a class selector
Named elements can be targeted with CSS rules
Class style rule must be applied to the
An ID can only be used once per page
IDs are unique
Used in addition to CSS rules
A hash or pound sign (#) precedes an id selector.
ID is another method for assigning names
ID style rule must be applied to the
Names so because pseudo-states don’t actually exist in
The user must do something to trigger the pseudo-class,
Visit a link
Hover over a link
Browse over a visited link
Previewing in a variety of browsers and browser versions
Sometimes the style rules conflict and you get enexpected
CSS set rules
For each element
Elements in HTML can nest.
Inside the body tag might be a div (division) named
content with adiv named newitem nested inside.
Each of these nested elements exist in a parent-child
relationship that allows CSS properties to be inherited.
The child elements are descendants of the parent and
inherit properties from them.