Cascading Style Sheet Flashcards
used to control the style of a web document in a simple and easy way.
CSS (Cascading Style Sheet)
CSS is the acronym for?
Cascading Style Sheet
Enumerate the key advantages of learning css:
- Create stunning website
- Become a web designer
- Control Web
- Learn Other Languages
- CSS handles the look and feel part of a web page.
- Using CSS, you can control the color of the text, the style of fonts, the spacing between paragraphs, how columns are sized and laid out, what background images or colors are used and others
Create Stunning Website
If you want to start a career as a professional web designer, HTML and CSS designing is a must skill
Become a web designer
- CSS is easy to learn and understand but it provides powerful control over the presentation of an HTML document.
- Most commonly, CSS is combined with the markup languages HTML or XHTML.
Control web
Once you understands the basic of HTML and CSS then other related technologies like javascript, php, or angular are become easier to understand.
Learn other languages
What is the output of this?
<!DOCTYPE html>
<html>
<head>
<title>This is document title</title>
<style>
h1 { color: red; }</style>
</head>
<body>
<h1>Hello World!</h1>
</body>
</html>
” Hello World! “ ( the text color is red)
Enumerate the application of css:
- CSS saves time
- Easy Maintenance
- Pages load faster
- Superior styles to HTML
- Multiple Device Compatibility
- Global web standards
You can write CSS once and then reuse same sheet in multiple HTML pages.
CSS saves time
To make a global change, simply change the style, and all elements in all the web pages will be updated automatically.
Easy maintenance
If you are using CSS, you do not need to write HTML tag attributes every time. Just write one CSS rule of a tag and apply it to all the occurrences of that tag.
Pages load faster
- CSS has a much wider array of attributes than HTML,
- Give a far better look to your HTML page in comparison to HTML attributes.
Superior styles to HTML
Style sheets allow content to be optimized for more than one type of device.
Multiple Device Compatibility
- HTML attributes are being deprecated and it is being recommended to use CSS.
- start using CSS in all the HTML pages to make them compatible to future browsers.
Global web standards
an HTML tag at which a style will be applied.
selector
A type of attribute of HTML tag which cover all the HTML attributes are converted into CSS properties.
Property
assigned to properties. An example is color property can have value either red
Values
syntax of CSS rules:
selector { property: value }
syntax that selects all the elements in a document
*{ color:red;}
selects all the elements in a document
Universal Selector
syntax that selects all elements that match selector
ul {color:red; }
Selects all elements that match selector
Type selector
syntax selects elements whose id attribute’s value matches the selector
intro { color=red; }
Selects elements whose id attribute’s value matches the selector
ID selector
Selects elements whose class attribute’s value matches the selector.
Class selector
syntax that applies to all elements whose class attribute’s value is “side”
.side { color-red; }
syntax that applies to all <p> elements whose class attribute’s value is “side.”
p.side { }
selector Selects elements whose class attribute’s values match the selector.
Multiple class
syntax that applies to all elements whose class attribute values are “side front back.“
.side,.front,.back { }
Selects an element that is a descendant of another specified element.
Descendant selector
syntax that selects an element that is a descendant of another specified element.
div p { color-red; }
Selects an element that is a direct child of another specified element
Child Selector
Syntax that applies to only <p> elements that are direct children of a <div> element.
div> p{color-red}
Selects an element that is the next sibling of another element.
Adjacent sibling selector
syntax that applies to only the first <p> element after an <h3> element.
h3+p { color-red; }
Selects an element that is a sibling of another element.
General sibling selector
syntax that applies to all <p>elements that are siblings of an <h3> element.
h3~p { color-red; }
Selects an element that has a specified attribute or an attribute-value pair.
Attribute selector
syntax that applies to all <em> elements with a “lang” attribute.</em>
em(lang) { color-red; }
select elements based on name, id, class
Simple Selectors
select and style a part of an element
Pseudo-elements selectors
select elements based on a certain state
Pseudo-class selectors
select elements based on an attribute or attribute value
Attribute selectors
select elements based on a specific relationship between them
Combinator selectors
TRUE OR FALSE
- The element selector selects HTML elements based on the element name.
-Here, all <p> elements on the page will be center-aligned, with a red text color:
True
the id attribute of an HTML element to select a specific element.
CSS id selector
The id of an element is unique within a page, so the id selector is used to select one unique
element!
ID SELECTOR
To select an element with a specific id, write a _________ character, followed by the id of the
element.
hash (#)
selects HTML elements with a specific class attribute.
Class selector
select elements with a specific class, write a period (.) character, followed by the class name.
Class Selector
selects all the HTML elements with the same style definitions.
CSS grouping selector
what is the comment for CSS
/* and ends with */
True or False
- You can add comments to your HTML source by
using the <!--...--> - a combination of HTML and CSS comments:
True
- are coded in the body of the web page as an attribute of an HTML tag.
- The style applies only to the specific element that contains it as an attribute
Inline Styles
- Theses are coded in a separate text file.
- This text file is associated with the web page by configuring a link element in the head section.
External Styles
- also referred to as internal styles) are defined within a style element in the head section of a web page.
- These style instructions apply to the entire web page document.
Embedded styles