-1

I'm a CSS noob, this is my very simple code:

This works:

#sortingAlbums,#sortingPictures { list-style-type: none; margin: 0; padding: 0; width: 80%; }

But if I try to do this:

 #sortingAlbums,sortingPictures li   { margin: 10px; padding: 0px;  font-size: 17px; 
height: 305px; width:225px; float: left; }

it does not work, so I am kind of stuck duplicating like so:

     #sortingAlbums li   { margin: 10px; padding: 0px;  font-size: 17px; 
height: 305px; width:225px; float: left; }
     #sortingPictures li { margin: 10px; padding: 0px;  font-size: 17px; 
height: 305px; width:225px; float: left; }

I was wondering if there is an easier way to get #sortingAlbums and $sortingPicture 's LIs to behave identical without duplicating them?

Ryan
  • 9,821
  • 22
  • 66
  • 101
  • possible duplicate of [Can I make this CSS simpler to avoid repeating the parent selector?](http://stackoverflow.com/questions/6894789/can-i-make-this-css-simpler-to-avoid-repeating-the-parent-selector) –  Nov 04 '14 at 03:18
  • See also http://stackoverflow.com/questions/25052635/is-there-a-way-to-shorten-css-selectors/25052868?s=5|1.0134#25052868. –  Nov 04 '14 at 03:20
  • Please include HTML for context – Jon P Nov 04 '14 at 04:22

1 Answers1

2

Each comma-separated value needs to be a complete, valid selector. So, this is what you're after:

#sortingAlbums li, 
#sortingPictures li 
{ 
    margin: 10px; padding: 0px;  font-size: 17px; 
    height: 305px; width:225px; float: left; 
}
Tieson T.
  • 20,774
  • 6
  • 77
  • 92