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 trialRajinder Sihota
3,473 Points3 columns of images, not IE compatable
<div class="custom1 grid_4"> <h2>Showcase Your Brand</h2> </div> <div class="custom2 grid_4"> <h2>Custom Banners</h2> </div> <div class="custom3 grid_4"> <h2>Custom Signs</h2> </div>
<div class="images grid_4">
<img src="img/banner1.jpg" title="Your Brand" width="300" height="270" />
</div>
<div class="images grid_4">
<img src="img/banner2.jpg" title="Custom Banners" width="300" height="270" />
</div>
<div class="images grid_4">
<img src="img/signs.jpg" title="Custom Signs" width="300" height="270" />
</div>
all inside a grid 12 container. Works perfectly in firefox and chrome but for some reason it isn't showing up properly in IE. www.sunnysihota.com Any suggestions on how to fix this or should I mess around with the css to make it work for IE FIRST as it seems to have the most issues.
6 Answers
Rajinder Sihota
3,473 PointsI never added any border
Žiga Miklič
5,675 PointsHello, the layout is broken because of the h2 headings before the images, as it is being pushed to 2 rows (because of the percentage based font sizing).
Solutions:
- either you change the font size of the h2 headings so it does not go to the second line
- you add a fixed height for the h2 headings (height not line height)
- add the headings in the same grid_4 div, causing the images to not be on the same line, but the layout won't brake
Also add at least 1em line-height to your h2 headings, so the text doesn't overlap.
I hope this helps!
Rajinder Sihota
3,473 PointsThanks Ziga, that worked. However another problem I'm having is that the text above the images isn't lined up properly. I want it centered above the images but it won't do that. This is the code I used to style the h2 titles.
.custom1, .custom2, .custom3 {
line-height: 1.4em;
color: #1F3569;
text-align: center;
width: 320px;
font-family: serif;
margin: 0px 0px;
font-size: 115%;
}
However it isn't centered properly, any help?
Žiga Miklič
5,675 PointsHello again! One tip: Start using an element Explorer like Google Developer Tools (which I prefer), Firebug or any other browsers dev tools. You will be able to spot issues much faster and learn from your mistakes. :)
Take a look at this picture:
I added an outline and some background to your .container_12 .grid_4 container, so you can see that the issue is with the container and not the heading itself.
I used this CSS to fix the issue (only tested in Chrome):
.custom1 {
margin-left: 10px;
}
.custom2, .custom3 {
margin-left: 20px;
}
Edit: I saw this right before I clicked the Answer button: the problem is that you assign the margin on:
.grid_1, .grid_2, .grid_3, .grid_4, .grid_5, .grid_6, .grid_7, .grid_8, .grid_9, .grid_10, .grid_11, .grid_12 {
margin-left: 10px;
margin-right: 10px;
}
But remove it here:
.custom1, .custom2, .custom3 {
margin: 0px 0px;
}
Sorry for the long answer as only the Edit part would be enough, but I think it is better that you know how to find the issue by yourself.
Rajinder Sihota
3,473 PointsThe first part worked. The second part of just changing margin to 0 0 didn't fix the issue for some reason.
I'll try figuring out how to use the developer tools, not sure yet how it will make things easier.
thanks for the help
Žiga Miklič
5,675 PointsHello, your already have the margin set to 0 0, you to remove the property from the rule .custom1, .custom2, .custom3.
You will see once you will know how to properly use the dev tools :)
Joe Shiels
19,933 PointsJoe Shiels
19,933 PointsIs there a border around the images in IE?