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 trialMichele Weisz
Courses Plus Student 1,269 PointsAdd h2 header in body (to remove all warnings in w3.org)
So, I did get an error on the Google link and replaced the pipe cht by %7C. Now I want to get rid of all warnings :-) I'm prompted to add a header to my gallery section.
So I added an h2 and gave it an id as there's already h2 defined in main.css for the header.
<section> <h2 id="galleryh2">gallery</h2> <ul id="gallery">
I succeeded in modifying the color
line 216 | in the /COLOR/ part
galleryh2 {
color:darkgreen; }
But I keep struggling to position the header. I want it left aligned to the first gallery image. I thought this would work, but it keeps pushing the first row of images to the right. Even though I removed the margin and padding.
line 87 | I added a body part above footer /****************** BODY ******************/
galleryh2 {
float:left; margin: 0; padding:0; }
How can I align my h2 in the section?
3 Answers
Liam Raven
10,875 PointsCouple of issues here.
- Each id should be unique (only use an id once)
- Make sure your css selectors are correct
- To follow W3C you should use a h1 as the main title inside a section (as semantically this is treated as separate content)
<section id="gallery">
<h1>Gallery</h1>
<ul>
</ul>
</section>
#gallery h1 {
float:left;
margin: 0;
padding:0;
}
Michele Weisz
Courses Plus Student 1,269 PointsThank you for your answers Abdullah and Liam,
Liam your answer helped me out, even if I didn't solve it exactly the way you suggested.
I was prompted by W3C to use h2-h6 headers. Probably because h1 in this exercise is used in the header part, that should have been another tag I think. Using two h1 tags is bad for SEO (but that's beyond the scope of this exercise).
I added #wrapper h2 to my css without adding another id and it works like a charm.
AR Ehsan
7,912 PointsMake sure your adding space between gallery and h2!