Use the :nth-child() pseudo-class:
li:nth-child(odd){
background-color: white;
}
li:nth-child(even){
background-color: green;
}
Related Posts:
- Customizing a WordPress theme without changing it?
- How can I version the main CSS file?
- Switching themes without losing widgets?
- can require “themefolder/includes/widgets.php” in “themefolder/functions.php” yet widgets.php doesn’t run
- Moving WordPress.com theme and widget settings to self-hosted site?
- Why are my widgets not saving when being added to a sidebar?
- I’m trying to add an image in my CSS
- How to use scss in wordpress theme?
- How to add the main style.css to my index.php?
- Duplicate and change a Theme Widget
- Current theme broken – after server and domain migration
- Getting rid of unused css directives [closed]
- Exclude stylesheet from admin
- hfeed CSS class in Twentyeleven Theme
- Change Theme from Plugin based on query_vars
- How do I copy my Parent Templates to my Child Templates?
- How do you create a custom WPTouch theme?
- How do I apply my CSS to a theme page?
- how to remove padding from left and right side? [closed]
- 404 Error while accessing the font files
- Changing $before_widget for certain widgets
- How to load parent theme style.css?
- adding multiple sidebars on pages
- Embedded Videos (PB) – Not Available
- Widgets menu does not appear under “Appearance” in dashboard
- How does a Child Theme works?
- Calling widget via function in themes files (hard code)
- Creating new templates in child themes breaks layout
- Inject widgets from one sidebar into another with PHP
- none of my css is working in my child theme
- How to conditionally display widgetized areas in theme customizer?
- Displaying a widget in sidebar only when no other widgets rendered?
- Remove transparancy in Sydney theme’s headerimage
- How can I add class to every quote element?
- CSS Start Fresh option on; main.css still being loaded [closed]
- How to style the post previews/links without it affecting the main posts?
- Restrict access to specific widget field based on user role
- Different logo on homepage
- Need to edit themes HTML code
- Child theme’s stylesheet cannot load [closed]
- Is it good practice moving the main stylesheets after the plugin styles?
- What Generated Classes and IDs That Is Always Used On All Themes?
- Passing dynamic options from backend to frontend
- Are there any official or unofficial guidelines for the styling of a widget?
- Calling external Libraries in WordPress
- What’s the default order used by WordPress to load CSS files?
- How to override / customize existing Widgets?
- Newbie wordpress question re banner height
- On a Https site, Css and Js Url are back to http after redirect the site
- How to access theme fonts using custom CSS style? [closed]
- Increase content area width in TwentyFourteen [closed]
- Using Grunt and keeping theme comments
- Background image appears on localhost site but not online
- Using filter in the widget causes fatal error
- Event Organiser breaks the theme [closed]
- disable default widgets in Responsive theme
- how would I change background color of a theme using a plugin?
- WordPress doesn’t recognise created theme
- Menu items do not “open” when mouse hover over them?
- My blog suddenly can’t find my stylesheet?
- What happened to my Inactive Widgets?
- WP Nanoplex 1.0.3 malfunction
- In a specific blog, the K2 theme does not have a Text Widget
- Broken theme, stylesheet is missing after uploading the right theme via FTP
- removing side space between para and container on generatepress?
- Removing a widget via theme editor
- sidebar in 2020 theme as a widget
- Remove the breadcrums on a theme W
- Enqueue All Stylesheets Found In a Theme Folder
- WordPress margin issues
- How Can I Disable WordPress Theme Self-Update?
- Remove style id inline CSS in WordPress
- How to customize a section of a widget only on certain pages or page
- how make wp include urls as https?
- style.css of my custom theme is not being applied at all
- CSS in child theme isn’t working properly
- WordPress loads old style.css, then loads current one
- Changing theme folder name disrupts widgets
- Strange Theme Error – parent style occasionally showing though child theme
- TwentyFourteen Theme : Changing grid layout
- Phone numbers showing same color as header [closed]
- Featured images are cropped on index and post page
- EM in CSS different size on wordpress then elsewhere [closed]
- Orion theme (from theme forest) [closed]
- How do I block a subdirectory from WordPress theming?
- Customising a theme
- Blog shows up without Theme/CSS styles
- How to Hide Blog Post Author?
- How can i limit wordpress post title characters in sidebar?
- How can I either move the nav bar down or create more space for the header? Theme – Ajaira
- Commenting in CSS (//) equals “none”? [closed]
- Help with responsive theme styling issue
- How to change the standard width of a page
- Theme install failed
- How can i remove footer credit text
- How to remove pop up on website (css changes not visible)?
- css on body tag in editor
- How can I add a new Styles option in WordPress 2024 theme?
- How do I remove the hamburger menu from the Twenty Twenty Four theme?
- How to cancel style.min.css file?