Skip to content

Instantly share code, notes, and snippets.

@tommyp
Created February 17, 2011 17:01
Show Gist options
  • Save tommyp/832119 to your computer and use it in GitHub Desktop.
Save tommyp/832119 to your computer and use it in GitHub Desktop.
/* this selects every p tag and makes them all 600px wide and have a margin of 20px */
p {
width: 600px;
margin: 20px;
}
/* the hash symbol looks for a tag with an id="intro" in your HTML, this gives it a width of 300px and a background color red */
#intro {
width: 300px;
background: red;
}
/* the dot looks for every tag with a class="large-image" and makes it 800px wide with a 3 pixel solid black border */
.large-image {
width: 800px;
border: 3px solid black;
}
/* you need to have the classes and IDs and elements in your HTML, the CSS just looks at the HTML for these and styles them, if you don't have them it'll do nothing (apart from the first example, as most sites will have tags like div, p, a, blockquote, img in common).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment