CSS Basics Flashcards
(131 cards)
What describes how input elements should look?
Ruleset
Which is the element or elements that will be targeted by the declarations that follow?
Selector
What does the declaration block follow?
The Selector
In CSS, what is a set of declarations contained in curly brackets {}
A Declaration Block
What consists of a property and the value it is to be set to?
A CSS rule-set consists of a selector and ________
A Declaration
Write CSS code to Target a set of elements named “sidebar” to have a width of 100 pixels.
.sidebar { width: 100px; }
In CSS, the property name is followed by a ?
Colon
In CSS, the value (after the property) is followed by a?
A semicolon.
In CSS, what is the method of adding coments to your code not to be shown or the temporarily disable “comment out” a block of code?
/* text here or code here */
When you’re writing a ruleset, try to keep your _______ as non-specific as possible.
Selectors
When you’re writing a ruleset, try to keep your selectors as 1)specific or 2)non-specific as possible.
2) Non specific.
In CSS what is used to specify (to target) a special state of the element?
Pseudo-class
In CSS what is used to style (target) specified parts of an element?
Pseudo-element
In CSS write a short ruleset to target the first letter of every paragraph. Also define this situation as either 1)pseudo-class or 2)pseudo-element
2) pseudo-element
p: :first-letter
In CSS write a short ruleset to generate hover behaviour over a container box named “foo”. Also define this situation as either 1)pseudo-class or 2)pseudo-element
1) Pseudo-Class
div. foo:hover {…}
To utilize CSS, we link to one or more _______________ that contain style rules which are applied to the linking HTML page.
External Stylesheets
Write HTML code including the opening and closing header section to link a stylesheet to the HTML page. (ignore answer ,,,)
,,<,,head,,>
,,<,,link rel=”stylesheet” type,,=”text/css” href=”./css/main.css”,,,>
,,<,,link rel=”stylesheet” type,,=”text/css” href=”./css/nav-bar.css”>
,,<,,/,,head,,>
Is “inline styling” to be avoided?
Yes. Engineers refer to this as maintaining the separation of concerns between HTML and CSS.
write HTML code (inline styling) to set the paragraph style to have a color of blue and a font of Arial. (in answer ignore ,,,)
,,<,,p style=”color: blue; font-family: Arial”,,>text text,,<,,/p>
What encodes information about how an element should look directly into the HTML (bypassing CSS)?
Inline Styles
Inline styles encode information about how an element should look directly into the HTML. Are you able to reuse these styles on other elements?
No
Are classes possible with inline styles?
No
What is DOM ?
Document Object Model
The Document Object Model is a cross-platform and language-independent interface that treats an XML or HTML document as a tree structure wherein each node is an object representing a part of the document. The DOM represents a document with a logical tree
If you include <style> and <link></link> elements in your document, they will be applied to the DOM \_\_\_\_\_\_\_\_\_ they are included in the document.</p>
</style>
In the order




