CSS Fundamentals Flashcards
Blank is a textual language for describing how a web page is styled for visual presentation.
CSS (Cascading Style Sheets)
Blank use CSS to determine how a web page is rendered on the screen, printed to paper, or presented via other media
Web browsers
The process of combining multiple style rules and resolving conflicting styles.
Cascading
Describes the visual presentation of structured documents.
Style Sheets
A web developer uses CSS to write a list of blank
rules
A blank consists of a selector followed by a declaration block between braces ({ }
CSS rule
A blank specifies the HTML elements to which the specific style rule applies.
CSS selector
A blank contains one or more declarations separated by semicolons (;)
declaration block
A blank is a CSS property followed by a colon (:) and the property value.
CSS styling declaration
Blank are only required to separate rule declarations
Semicolons
CSS can be applied to HTML in what three ways
An inline style
An embedded stylesheet
An external stylesheet
places CSS declarations inside a tag’s style attribute.
inline style
places CSS rules in an HTML document’s head using <style> tags.</style>
An embedded stylesheet
places CSS rules in a separate file that is imported into an HTML document with a <link></link> tag
An external stylesheet
The blank attribute may be used on any tag.
style
good practice is to place blank and blank tags inside the document head (before the <body> tag).
<style>
and <link></style>
Every browser has a blank that specifies styling for each HTML element.
default stylesheet
The style declarations from a parent element cascade down and are applied to any child elements, a concept called blank.
inheritance
Each element blank the style declarations from the element’s parent.
inherits
When two style declarations with identical properties apply to the same element, a blank occurs
conflict
A parent’s style declaration conflicts with a child’s style declaration. Ex: The parent element’s text is blue, but a child element’s style declaration indicates the color should be green. When a conflict occurs, the blank overrides the blank.
child’s declaration
parent’s declaration
An embedded or external stylesheet’s style declaration conflicts with an inline style. Ex: An inline style says the element should be blue, but the embedded stylesheet says the element should be green. When a conflict occurs, an blank overrides the blank’s declaration.
inline style
embedded or external stylesheet
The browser uses blank, a scoring system that resolves more complex CSS conflicts, to determine what style declarations apply to an element.
specificity
The blank rule may be used on a style declaration to override other declarations and disregard specificity.
!important
The blank matches elements with the specified element names.
Ex: p { color: blue; } selects all p elements.
element selector
The blank, specified with a period character followed by the class name, matches elements that have the specified class name.
Ex: .notice { color: blue; } selects all elements with a class=”notice” attribute.
class selector
The blank, specified with a hash character followed by the ID name, matches the element that has the specified ID.
Ex: #byLine { color: blue; } selects the element with the id=”byLine” attribute.
ID selector
The blank, specified with a selector followed by a space and another selector, matches elements that are contained in other elements.
Ex: h2 em { color: blue; } selects em elements contained in h2 elements.
descendant selector
The blank, specified with a colon character followed by a pseudo-class name, matches elements based on user behavior or element metainformation.
Ex: :hover { color: blue; } selects elements under the mouse cursor.
pseudo-class selector
An HTML tag’s blank specifies the classes to which the tag belongs, with each class name separated by a space. Ex: <span> has two classes, highlight and first. While HTML elements’ IDs are unique, many elements may use the same HTML class name.</span>
class attribute
:enabled - means
Element is enabled.
:lang(language) - means
Element contains text in a specified language.
:empty - means
Element has no child elements.
:hover - means
Mouse is hovering over the element.
Blank and blank can combine with element names to match more specific elements. Ex: a:hover selects only the anchor tag the mouse is hovering over, and span.highlight selects only span elements that have the highlight class attribute.
Class selectors and pseudo-class selectors
The blank, specified using an asterisk character (*), matches all elements in the web page.
universal selector
The blank, specified using a comma (,) to separate selectors, matches all listed elements to apply a style rule. Ex: The figure below shows two CSS examples that apply the same styles to <ol> and <ul> elements.
multiple selector
The blank, specified using a greater than character (>) between two selectors, matches any elements where the second element is a direct child of the first element. The child selector is similar to the descendant selector (space between selectors), but the matching child element in the child selector must be a direct child of the matching parent element.
child selector
Blank are elements that share the same parent element.
Sibling elements
The blank, specified using a tilde character (~) between two selectors, matches the second element if the second element occurs after the first element and both elements are siblings. Any number of other elements can be placed between two general sibling elements.
general sibling selector
The blank, specified using a plus character (+) between two selectors, matches an element that immediately follows another element, where both elements have the same parent.
adjacent sibling selector
Blank are CSS selectors that match specific relationships between other selectors. The descendant, child, adjacent sibling, and general sibling selectors are all blank.
Combinators
The blank, specified with an attribute name and optional value comparison enclosed in square brackets ([ and ]), matches elements with the specified attribute or the specified attribute and value. Ex: a[target] selector matches anchor elements with a target attribute specified.
attribute selector
= means [target=”_blank”]
<a></a>
Attribute has exact value
~= means [alt~=”sad”]
<img></img>
Attribute contains whole word
^= means [class^=”nav”]
<ul>
<ul>
</ul></ul>
Attribute begins with value
The blank, specified with two colon characters (::) followed by a pseudo-element, matches parts of elements. The pseudo-element selectors allow styles to apply to the first line or first letter of text of an element or to text that is selected by the user, or allow additional content to be inserted before or after an element.
pseudo element selector
::after means li::after { content: “<” }
Add content after the matched element.
::before means li::before { content: “***” }
Add content before the matched element.
::first-line means p::first-line { color: red }
Match the first line of text in a block element.
::first-letter means p::first-letter { font-size:200% }
Match the first letter of text in a block element.
::selection means ::selection { background: yellow }
Matches the text selected by user.
The blank CSS property changes the text color to a specified color value
color
CSS defines blank color names. Ex: white, blue, black, gray, forestgreen, magenta.
140
An blank specifies a color using the rgb(red, green, blue) function by indicating the red, green, and blue intensities. Each intensity for red, green, and blue is between 0 and 255, where 0 is the lowest intensity and 255 is the highest.
RGB color value
A blank specifies a color using the #RRGGBB format by indicating the red, green, and blue intensities. Each intensity for red, green, and blue is between 00 and FF hexadecimal numbers, where 00 is the lowest intensity and FF is the highest.
Ex: #000000 is black, #0000FF is blue, #FFFF00 is yellow, and #FFFFFF is white.
hexadecimal color
An blank specifies a color using the hsl(hue, saturation, lightness) function by indicating the hue, saturation, and lightness values. The hue value ranges between 0 and 360, and the saturation and lightness values range between 0% and 100%. Ex: hsl(0, 0%, 0%) is black, hsl(120, 100%, 50%) is green, and hsl(0, 100%, 25%) is dark red.
The HSL color specification method is harder to understand and is not used as frequently as the RGB and hexadecimal color specification methods.
HSL color value
The RGB and HSL color values can add an blank to allow for transparency. The RGBA color value specifies a color using the rgba(red, green, blue, alpha) function by indicating the red, green, blue, and alpha intensities. The HSLA color value specifies a color using the hsla(hue, saturation, lightness, alpha) function by indicating the hue, saturation, lightness, and alpha intensities. The intensities have the same ranges as for RGB or HSL color values, but the alpha intensity is between 0 and 1. An alpha of 0 means fully transparent, 1 means fully opaque, and 0.5 means half transparent.
alpha value