Frontend Engineering, Volume II
CSS: Example 2a—Try Border Styles
© 2013, Martin Rinehart
We added <span>
-based boxes to the examples page we made for Chapter 1. You want to try each of these border styles:
- solid
- double
- dotted
- dashed
- inset
- outset
- ridge
- groove
- none
Add Elements to the Markup
Use the .HTML page from example 01e (last chapter) or create a new HTML page from your template.
Add the following divs (copy, nothing to learn from typing these) to your page.
Note that we have both classes and IDs for the span
s. We'll use the class for the common styles, the IDs for the unique styles. We also style the div
s.
Add Styles to the Embedded Style Sheet
We'll need two classes. One for the div
s and another for the span
s. We add this in alphabetical order in the existing classes.
Style the div
s
Add styles for the border_divs
class. Typing would be good. You want to know these styles.
Style the span
s
First, style the try
class.
And then style the individual borders.
Add a border-style
rule for each span.
View the Results
Your result should look like this:

Why display: inline-block
? The <span>
is an inline-level element. It would default to display:inline
. What would happen if you used display:block
? That's a good question. We're saving it for the quiz. Here's a hint:
You can use CSS comments to test various property values without doing much typing.
display:inline/*-block*/;
display:/*inline-*/block;
display:static/*inline-block*/;
Feedback: MartinRinehart at gmail dot com
# # #