Chapter 3 Quiz Flashcards
To further the effort to let HTML be used to define the structure of a document only, and not appearance, what was introduced?
Cascading style sheets
What is a cascading style sheet?
Code that specifies formatting based styles
What are three ways to apply CSS?
inline style, internal style, and external style
What is the simplest way to attach a tag?
Using inline styles
What is the correct syntax for displaying the level 1 heading “I’m so blue” in blue italics using inline style formatting?
h1 style=”color: blue; font-style: italic;” I’m so blue /h1
Where are inline styles defined?
Within the HTML tag
An inline style is created by adding what attribute to an HTML tag?
Style attribute
A CSS property is separated from its value by what?
Colon and a space
Multiple CSS property-value pairs are separated from each other by what?
Semi-colon and a space
What does the span tag do?
It allows us to set an inline style for all the content within the tag.
What is the drawback of inline styles?
They need to be created within each tag, one-time use, difficult to maintain, harder to read, need to be created everywhere and every time it is needed.
How are internal styles different from inline styles?
Internal styles are defined within the head section of the document and not in each individual tag. Internal styles affect the entire page while inline style only affects the tag it is in.
Internal styles are defined within what specific tag in the head section of an HTML document?
style
If internal styles aren’t defined within an HTML tag, how does the browser know where to apply the style?
By the selector.
Within the style tag, what is the type attribute set to in all cascading style sheets?
text/css
What are selectors?
Pieces of code that determine what sections of a page are affected by a specific style.
After the selector is identified, the property-value pairs are defined and enclosed with what?
Curly brackets
What types of selectors are available?
Element name, element and attributes, classes, Ids, and pseudo-classes.
What is the benefit of internal styles?
They can be applied through the entire web page, easier to use.
What is an element selector?
An element name used to specify style for all instances of that element.
Can element selectors be grouped, or must they always be defined individually?
They can be grouped by separating them with a comma h1, h2, h3
What does a contextual selector do?
Allows you to specify style under certain conditions. (p a {font-family: Verdana}
Regarding selectors, what is a class?
A class is a way to create style that is not tied to a specific tag element.
How would you identify a class?
Dot before the name
How do you create a class?
Add a class=argument to the opening tag of the element then in the style area, add a style to define the class.
In regards to selectors, what is an ID?
It is like a class, but more specific.
How would you identify an ID?
The # before the name.
What is the difference between a class and an ID?
Classes create styles to more than one type of element or create several different styles for the same element while IDs typically are used only when a specific instance needs a particular style.
What is the universal selector and what does it do?
It is the asterisk, selects everything and applies that style.
What is a pseudo-class?
They define special relationships and allow style to be applied. For example, first letter, line, and links.
When would you use a pseudo-class?
When you want to change the appearance of links or specific text
What is an external style sheet?
It is a separate file with an extension of .css that contains the style formatting for all files linked to it
What is the benefit of an external style sheet?
It is a separate file with a .css extension that contains the style formatting for all files linked to it.
How would you create an external style sheet?
In textEdit, add all the styles that affect the Web pages and save the file with a .css extension.
Do external style sheets require the use of selectors?
Yes
Do external style sheets require the use of the style tag?
no
How do you apply an external style sheet to a HTML file?
Add the link tag to the HTML file.
What method of applying CSS would you use if your site were only a page?
Internal style
What method of applying CSS would you use if your site had more than a page?
External style sheet
When would you want to use the inline style?
To create style for exceptions to the general style information you created in an internal or external style sheet because inline styles always take precedence over internal and external sheets if they overlap.