Professional Documents
Culture Documents
Lesson 2 CSS Selectors Div Span and Link
Lesson 2 CSS Selectors Div Span and Link
Colon
color: red;
} Value
Property
Declaration
Block
CSS Structure
Selectors indicate which element the rule
applies to. The same rule can apply to more
than one element if you separate the element
names with commas.
Backdrops:
- These are full sized
backdrops, just scale them up!
- Can be Copy-Pasted out of
Templates for use anywhere!
Display Property
• CSS display property allows you to
control how an element is displayed.
• Block level element is laid out vertically.
As you can see, a new paragraph begins
with a new line after the end of another
paragraph.
• Inline level element is laid out horizontally
and will only proceed to the next line
when the end of the line is reached.
Display Property
Kind Description Example
Block Level Laid out vertically <p> block
Elements <p> block
Inline Level Laid out <em> element <b> element
Elements Horizontally
The following code, without the display
property, will give the result as shown below.
<html>
<head>
<title>Display Property</title>
<style type=“text/css”>
<!--
p.blue { color: blue; }
h1#red { color: red; }
-->
</style>
</head>
<h1 id=“red”> Visual Guide Series</h1>
<p class=“blue”>Cretive Design CS5</p>
<p class=“blue”>Web Design</p>
<p>Animation and Multimedia</p>
</body>
</html>
The following code, without the display property, will give the
result as shown below.
Property for Display
Property Keyword Description
display: Inline Inline display or horizontal layout
display: block Block display or vertical layout
display: list-item Display as a list item <li>
display: none No box or the element has no effect
on the layout
display: inherit Inherit value from parent
Adding the inline display attribute inside the
CSS style results in a browser output as shown.
<html>
<head>
<title>Display Property</title>
<style type=“text/css”>
<!--
p.blue { color: blue; }
h1#red { color: red; }
p {display: inline; }
-->
</style>
</head>
<h1 id=“red”> Visual Guide Series</h1>
<p class=“blue”>Cretive Design CS5</p>
<p class=“blue”>Web Design</p>
<p>Animation and Multimedia</p>
</body></html>
Result: