Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

How to apply CSS to :last-child button

How to apply CSS to :last-child button

Problem

See picture example below, I'd like to know how it is possible to make the last button in a row of divs a different color. Can it be achieved using :last-child using CSS within the DIVs?

I'd like to make the last button green like the design I have below:

Thanks!

HTML:

Daily office cleaning

Office, meeting rooms, communal areas, washrooms and hygiene areas.

Learn More

Retail cleaning

The Cleaning and maintenance of public circulation areas, shopping centres, retail complexes etc.

Learn More

Educational cleaning

The general cleaning of all aspects of public sector establishments, schools and colleges.

Learn More

Specialist cleaning

We also provide specialist cleaning and support services.

Learn More
Problem courtesy of: Tim

Solution

Using :last-child:

.services .span3:last-child .btn {
   background : green;
}

Using adjacent sibling selector:

.services .icon_special + p + .btn {
    background: green;
}
Solution courtesy of: koala_dev

Discussion

View additional discussion.



This post first appeared on CSS3 Recipes - The Solution To All Your Style Problems, please read the originial post: here

Share the post

How to apply CSS to :last-child button

×

Subscribe to Css3 Recipes - The Solution To All Your Style Problems

Get updates delivered right to your inbox!

Thank you for your subscription

×