• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Chapter 33. Styling for HTML Elements > Simple Selectors in CSS

Simple Selectors in CSS

A CSS style rule begins by identifying the group of elements it applies to via the selector. Sometimes it's just a single element, designated by the id attribute and prefixed with a hash mark (#), as Listing 33.1 demonstrates.

Listing 33.1. Setting Styling By ID

<?xml version="1.0" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head><title></title>
<style type="text/css">
<!--
#hello {
  text-indent: 15px
  }
-->
</style>
</head>
<body>
<p id="hello">Indented Text.</p>
<p>Non-indented text.</p>
<!-- Results:
 Indented Text.
Non-indented text.
-->
</body>
</html>


					  


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint