Friday, April 29, 2011

Horizontal Rules in Color

Obstinacy and heat in sticking to one's opinions is the surest proof of stupidity. Is there anything so cock-sure, so immovable, so disdainful, so contemplative, so solemn and serious as an ass? (Michel de Montaigne in The Book Of Choices by Mike Magee, M.D., p. 231)


I spent two or three days trying to understand how to draw horizontal rules in red, blue and black using Cascading Style Sheets (CSS). Right now I have at least a half dozen books available from my own collection and the library. None of them described how to do this. I also tried looking at some of the sample code available online. Most of the examples were quite complicated and the ones I tried didn't work. This morning I finally succeeded. I used information from two different sections of a book by Elizabeth Castro. She didn't actually illustrate how to do it.

Here's the Cascading Style Sheet (CSS) Code.

p {color: black} {border-top: 5px; border-style: solid; padding: 0px;}
p#black {color:black}
p#red {color:red}
p#blue {color:blue}

Here's the HTML Code (enclose each line in <>)

p class="hr" id="red"
p class="hr" id="black"
p class="hr" id="blue"

Mr. Dickie
29/Apr/2011 9:37

No comments: