Save
comp
Save
Share
Learn
Content
Leaderboard
Learn
Created by
Bianca
Visit profile
Cards (23)
CSS means
Cascading Style Sheet
CSS
is a language that defines the style of
HTML
documents
Cascade
means appearance embedded in different style sheets
Style
is a
formatting rule
Basic
CSS has a rule, that consists of
two
main parts: selector and declaration
Selector refers to an
HTML
tag you want to
style
Declaration
consists of a
property
and corresponding value and is within curly brackets.
property
- a style attribute that needs to be formatted
value
- a numeric or text value used in the property to format a web page
basic
structure of CSS code: p {color:pink;}
p
- selector
color - property
pink - value
comments
- used to describe a code/can be a
word
-
starts
with /* and
ends
with */
style sheet - a separate code that manipulates the overall look of the elements of your HTML
3
different ways to insert CSS into HTML documents:
Inline
Internal
External
Inline
Style Sheet - rules are directly embedded to an HTML element using style
attribute
- has the highest priority
Internal
Line Style Sheet - defines rules in the header section of the HTML document using <style> tag
- has the second highest priority
External
Line Style Sheet - defines rules in a separate .css file and does not contain any document content or element
- embeds the file in an HTML document using <link> tag
- has the third highest priority
rel
- this attribute takes the value "
style sheet
"
type
- this attribute takes the value "
text
/css."
href
- indicates the name and location of the external style sheet to be used
browser
's default style - has the
lowest priority
CSS has two common types of selectors -
ID
and
Class
ID and
Class
- they make it possible to specify a style for a variety of
tags
Class Selector
- used to specify a style for a group of
elements
- to indicate a
style
for a set of
elements
- defined
starting
with "." followed by its
name
ID
selector - used to indicate a style for a single and unique element
- defined with # sign before the name
- can be used in internal or external style sheet
- can only be applied to a single element