Title: CSS specificity problem
Last modified: August 21, 2016

---

# CSS specificity problem

 *  [PODxt](https://wordpress.org/support/users/podxt/)
 * (@podxt)
 * [12 years, 4 months ago](https://wordpress.org/support/topic/css-specificity-problem/)
 * Hi,
 * I wrote this code on my home page and I’m trying to set a CSS property on only
   the homepagediv class for ul and li items.
 *     ```
       <div class="homepagediv">
       	<div class="panel-grid-cell" id="sitelatestposts">
       	<h1 class="blogtitle">News</h1>
       		<div class="sitelatestpostsimg">
       			<ul>
       				<li><a href="<?php the_permalink() ?>"><?php the_post_thumbnail(array( 220,130 )); ?></a>
       				</li>
       			</ul>
       		</div>
   
       	</div>
       	<div class="panel-grid-cell" id="siteinfos">
       	<h1>Contact</h1>
       	<p>Phone 992-552-6233</p>
       		<div class="testingdiv">
       			<ul>
       				<li><p>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p></li>
       				<li><p>Sed quis bibendum leo, quis dictum sapien.</p></li>
       			</ul>
       		</div>
       	</div>
       </div>
       ```
   
 * The problem is that at the start of my CSS I have:
 *     ```
       ul {
       	padding: 0 0 0 40px;
       }
       ```
   
 * When I try things like:
 *     ```
       .homepagediv li{
       	padding: 0;
       }
       ```
   
 * the li padding is still at 40px instead of 0 for this div.
    Any ideas?

Viewing 4 replies - 1 through 4 (of 4 total)

 *  [Bazan](https://wordpress.org/support/users/bazan/)
 * (@bazan)
 * [12 years, 4 months ago](https://wordpress.org/support/topic/css-specificity-problem/#post-4531549)
 *     ```
       .homepagediv ul {padding:0}
       ```
   
 *  [esmi](https://wordpress.org/support/users/esmi/)
 * (@esmi)
 * [12 years, 4 months ago](https://wordpress.org/support/topic/css-specificity-problem/#post-4531551)
 * Try using Firefox with the [Firebug add-on](http://getfirebug.com/) for this 
   kind of CSS troubleshooting. Or use whatever developer tool is available in your
   web browser.
 *  Thread Starter [PODxt](https://wordpress.org/support/users/podxt/)
 * (@podxt)
 * [12 years, 4 months ago](https://wordpress.org/support/topic/css-specificity-problem/#post-4531552)
 * Thanks, why wouldn’t it work with li?
 *  [Bazan](https://wordpress.org/support/users/bazan/)
 * (@bazan)
 * [12 years, 4 months ago](https://wordpress.org/support/topic/css-specificity-problem/#post-4531559)
 * Because padding for li was 0 before too 🙂
 * How u want to change ul when u set padding to li? ;P
 * In styling ULs i am using a pattern like this (for example menu):
 *     ```
       #site-menu {}
       #site-menu ul {}
       #site-menu ul li {}
       #site-menu ul li a {}
       #site-menu ul li:hover a {}
       #site-menu li ul {}
       #site-menu li li {}
       ```
   
 * to never forget all styles 🙂

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘CSS specificity problem’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 4 replies
 * 3 participants
 * Last reply from: [Bazan](https://wordpress.org/support/users/bazan/)
 * Last activity: [12 years, 4 months ago](https://wordpress.org/support/topic/css-specificity-problem/#post-4531559)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
