Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial
budoor ayhd
1,471 Pointswhy can't use <ul> selector rather then #gallery ?
Hello, why can't use <ul> selector rather then #gallery ? ul { list-style: none; margin: 0; padding: 0; }
ul li { float: left; width:45%; margin: 2.5%; background-color:azure; color: aquamarine;
}
1 Answer
Steven Parker
243,658 Points
An ID attribute is always unique.
An advantage of targeting the ID is that it is guaranteed to be the element we want to style. A document might contain more than one UL element, either now or in the future, so targeting that will affect all of them. This would not be a good choice when we want to style only a specific one.
If that doesn't answer your question, please provide a link to the course page you were working with to allow a more specific answer.