Cascading Style Sheets Tutorial

CSS achieve dynamic display by the five-pointed star-level results

  Perhaps you see above this paragraph some Shengse, no, let us have a look at css code solution 

  <ul Class="star-rating"> 
  <li Class="current-rating"> Currently 3.5 / 5 Stars. </ Li> 
  <li> <a Href="#" title="1 star out of 5" class="one-star"> 1 </ a> </ li> 
  <li> <a Href="#" title="2 stars out of 5" class="two-stars"> 2 </ a> </ li> 
  <li> <a Href="#" title="3 stars out of 5" class="three-stars"> 3 </ a> </ li> 
  <li> <a Href="#" title="4 stars out of 5" class="four-stars"> 4 </ a> </ li> 
  <li> <a Href="#" title="5 stars out of 5" class="five-stars"> 5 </ a> </ li> 
  </ Ul> 

<style>
  . Star-rating (/ * This is stratified air, air to display the stars * / 
  List-style: none; 
  Margin: 0px; 
  Padding: 0px; 
  Width: 150px; 
  Height: 30px; 
  Position: relative; 
  Background: url (star_rating2.gif) top left repeat-x; / * Air stars in the top background picture, and its background as a horizontal tiled * / 
  ) 
  . Star-rating li (/ * Set up li floating attribute * / 
  Padding: 0px; 
  Margin: 0px; 
  / * \ * / 
  Float: left; 
  / * * / 
  ) 
  . Star-rating li a (/ * Set up a layout for the absolute and layout and vertical coordinates of the hide into a Chinese air link * / 
  Display: block; 
  Width: 30px; 
  Height: 30px; 
  Text-decoration: none; 
  Text-indent:-9000px; 
  Z-index: 20; 
  Position: absolute; 
  Padding: 0px; 
  ) 
  . Star-rating li a: hover (/ * Set up a: hover in the background picture for the points Star / vertical coordinates / left for 0, attention must be less than the vertical coordinates of the vertical coordinates of a * / 
  Background: url (star_rating2.gif) left center; 
  Z-index: 2; 
  Left: 0px; 
  ) 

  / * The following five class used to set up five locations and links to hover width * / 
  . Star-rating a.one-star ( 
  Left: 0px; 
  ) 
  . Star-rating a.one-star: hover ( 
  Width: 30px; 
  ) 
  . Star-rating a.two-stars ( 
  Left: 30px; 
  ) 
  . Star-rating a.two-stars: hover ( 
  Width: 60px; 
  ) 
  . Star-rating a.three-stars ( 
  Left: 60px; 
  ) 
  . Star-rating a.three-stars: hover ( 
  Width: 90px; 
  ) 
  . Star-rating a.four-stars ( 
  Left: 90px; 
  ) 
  . Star-rating a.four-stars: hover ( 
  Width: 120px; 
  ) 
  . Star-rating a.five-stars ( 
  Left: 120px; 
  ) 
  . Star-rating a.five-stars: hover ( 
  Width: 150px; 
  ) 

  . Star-rating li.current-rating (/ * Set up scores of the background and the width and hidden text * / 
  Background: url (star_rating2.gif) left bottom; 
  Position: absolute; 
  Height: 30px; 
  Width: 105px; 
  Display: block; 
  Text-indent:-9000px; 
  Z-index: 1; 
  ) 
  </ Style> 

  After reading these, I believe you should be aware that one of the tenets of the bar, or if I do not understand the message can be, or perhaps I write not good enough:) 

  A total of two.    9 7 1 2 

Share and Enjoy: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • del.icio.us
  • Facebook
  • Google
  • DotNetKicks
  • DZone

Tags: css display, Display

Releated Posts

  • Css create classic mouse trigger Display Options
  • Using xml, xsl, css display data
  • CSS Case Analysis and Display Visibility different attributes
  • Display: inline-block attributes
  • CSS in IE and Nascape display differences

This entry was posted on Thursday, February 7th, 2008 at 12:00 am and is filed under CSS Properties. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

« CSS cascading style sheet with the completion of the flashing effect can be controlled
The CSS »

Leave a Reply

  • Categories

    • CSS Properties (491)
    • CSS Tutorial (1154)
    • CSS Tutorial By Examples (1201)
    • Css+Div Web Design (3274)
    • Xhtml and Web Design (1797)
  • Archives

    • February 2008
    • January 2008
    • December 2007
    • November 2007
    • October 2007
    • September 2007
    • August 2007
    • July 2007
    • June 2007
    • May 2007
    • April 2007
    • March 2007
    • February 2007
    • January 2007
  • Pages

    • About us

Cascading Style Sheets Tutorial