Selector Basics : selector « Style Basics « HTML / CSS






Selector Basics

 
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Selector Basics</title>
<style type="text/css">
#article {
  background-color: #FDF8AB;
  background-image: url(images/bg_page.png);
  background-repeat: repeat-y;
  background-position: center top;
  padding: 0;
  margin: 0 auto;
  width: 760px;
}

p {
  color: #505050;
  font-size: 1em;
  font-family: "Helvetica Neue", Arial, Helvetica, sans-serif;
  margin-left: 100px;
}

h1, h2, h3 {
  color: #BD8100;
  font-family: Baskerville, "Palatino Linotype", Times, serif;
  border-top: 2px solid #86A100;
  padding-top: 7px;
    padding-left: 100px;
}


.note {
  color: #333;
  border: 2px dashed #BD8110;
  background-color: #FBF8A9;
  margin-top: 25px;
  margin-bottom: 35px;
  padding: 20px;
}
.note strong {
  color: #FC6512;
}


h1+p {
  color: #FF6600;
  font-size: 1.2em;
  line-height: 140%;
  margin-top: 20px;
}
</style>
</head>
<body id="article">
  <h1>Heading</h1>
  <p>Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt. </p>
  <p>Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt. Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem. Ut enim ad minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur? Quis autem vel eum iure reprehenderit qui in ea voluptate velit esse quam nihil molestiae consequatur, vel illum qui dolorem eum fugiat quo voluptas nulla pariatur?</p>
  <p class="note"><strong>NOTE:</strong>   minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur? </p>
</body>
</html>

   
  








Related examples in the same category

1.Universal Selector
2.The Type Selector
3.The Class Selector
4.The ID Selector
5.The Child Selector
6.The Descendent Selector
7.The Adjacent Sibling Selector
8.Attribute Selectors
9.Using Attribute Selectors to select different textfields
10.Using Attribute Selectors to choose anchor by link type
11.Using Attribute Selectors to choose only mailto anchor type
12.Using Attribute Selectors to choose linked file type for anchor
13.Using Attribute Selectors to choose php links
14.Using Dynamic Pseudo-Classes to change color
15.Using Dynamic Pseudo-Classes to add text decoration
16.Dynamic Pseudo-Classes: hover effect
17.Selectors and Grouping
18.Class Selectors: A class represents something that you can have more than one of.
19.chain together class names within the class attribute.
20.An id is used but once per document.
21.Universal selectors are wildcard selectors.
22.Descendant Selectors
23.Next Sibling Selectors
24.Attribute Substring Selectors
25.Pseudo-Element Selectors
26.Dynamic Pseudo-Class Selectors
27.Using Different Selectors to Apply Styles
28.First Child Pseudo-Selector
29.Before and After Pseudo Selectors
30.Style sheet for example demonstrating adjacent sibling and child selectors
31.paragraph with id selector
32.Direct Child Selectors
33.A specific selector wins, the last one wins
34.Select one item
35.direct adjacent sibling combinator