I'm trying to come out with a table-like layout, with medicine names appearing on the left and the data occupy the rest of the table. Simply put:
+-------------+------------+
medicine 1 | some data | some data |
+-------------+------------+
medicine 2 | some data | some data |
+-------------+------------+
Since I want to keep the data grid dynamic, I use two <div>'s with the style display:table-cell as two containers, the left one for all the medicine names, and the right one for the data grid. There are several inner <div>'s inside these two table-cell <div>'s, but I'm not sure why the left one has a big padding area on the top when I use Chrome inspect interface to investigate it (please see the image below):
I'm not quite sure which part went wrong, and the inspect interface didn't give me information that seems relevant. I want to learn how to approach this situation. Here is the html code for your reference:
<div style="display:table">
<div style="display:table-row">
<div style="display:table-cell">
<div style="height:85px; width:170px; text-align:right; font-size:13px; margin-right:5px">
Dexedrine Spansules (Dextroamphetamine, ER) <br/><span style="font-style:italic">(20mg)</span>
</div>
<div style="height:85px; width:170px; text-align:right; font-size:13px; margin-right:5px">
Methamphetamine (Desoxyn, IR) <br/><span style="font-style:italic">(15mg)</span>
</div>
</div>
<div style="display:table-cell; overflow:hidden; max-width:800px">
<div id="medicine_table_container_2" class="medicine-table-container" style="position:relative; left:0">
<div style="white-space:nowrap; font-size:0px">
<div style="display:inline-block; background-color:yellow; width:130px; height:85px; border:1px solid #999; font-size: 12px; white-space:normal">
<div>
<div style="display:inline-block; width:70px; height:45px">
Morning<br/>-
</div>
<div style="display:inline-block; width:50px; height:45px">
Noon<br/>5mg
</div>
</div>
<div>
<div style="display:inline-block; width:70px; height:35px">
Afternoon<br/>12mg
</div>
<div style="display:inline-block; width:50px; height:35px">
Evening<br/>-
</div>
</div>
</div>
</div>
<div style="white-space:nowrap; font-size:0px">
<div style="display:inline-block; background-color:yellow; width:130px; height:85px; border:1px solid #999; font-size: 12px; white-space:normal">
<div>
<div style="display:inline-block; width:70px; height:45px">
Morning<br/>-
</div>
<div style="display:inline-block; width:50px; height:45px">
Noon<br/>5mg
</div>
</div>
<div>
<div style="display:inline-block; width:70px; height:35px">
Afternoon<br/>12mg
</div>
<div style="display:inline-block; width:50px; height:35px">
Evening<br/>-
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
This is about vertical alignment. The default one is set to baseline and produce this output. Simply change the alignment to top on the table-cell and you won't have this issue:
<div style="display:table">
<div style="display:table-row">
<div style="display:table-cell;
vertical-align: top;">
<div style="height:85px; width:170px; text-align:right; font-size:13px; margin-right:5px">
Dexedrine Spansules (Dextroamphetamine, ER) <br/><span style="font-style:italic">(20mg)</span>
</div>
<div style="height:85px; width:170px; text-align:right; font-size:13px; margin-right:5px">
Methamphetamine (Desoxyn, IR) <br/><span style="font-style:italic">(15mg)</span>
</div>
</div>
<div style="display:table-cell;
vertical-align: top; overflow:hidden; max-width:800px">
<div id="medicine_table_container_2" class="medicine-table-container" style="position:relative; left:0">
<div style="white-space:nowrap; font-size:0px">
<div style="display:inline-block; background-color:yellow; width:130px; height:85px; border:1px solid #999; font-size: 12px; white-space:normal">
<div>
<div style="display:inline-block; width:70px; height:45px">
Morning<br/>-
</div>
<div style="display:inline-block; width:50px; height:45px">
Noon<br/>5mg
</div>
</div>
<div>
<div style="display:inline-block; width:70px; height:35px">
Afternoon<br/>12mg
</div>
<div style="display:inline-block; width:50px; height:35px">
Evening<br/>-
</div>
</div>
</div>
</div>
<div style="white-space:nowrap; font-size:0px">
<div style="display:inline-block; background-color:yellow; width:130px; height:85px; border:1px solid #999; font-size: 12px; white-space:normal">
<div>
<div style="display:inline-block; width:70px; height:45px">
Morning<br/>-
</div>
<div style="display:inline-block; width:50px; height:45px">
Noon<br/>5mg
</div>
</div>
<div>
<div style="display:inline-block; width:70px; height:35px">
Afternoon<br/>12mg
</div>
<div style="display:inline-block; width:50px; height:35px">
Evening<br/>-
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
Since your code is a bit complex, here is a basic one to reproduce the issue and better understand what's happening:
.table {
display: table;
border: 1px solid;
margin: 5px;
}
.table>div {
display: table-row;
}
.table>div>span {
display: table-cell;
padding: 0 5px;
}
.table>div>span span {
display: inline-block;
}
baseline
<div class="table">
<div>
<span>one line</span>
<span><span>two <br> line (inline-block)</span></span>
</div>
</div>
baseline
<div class="table">
<div>
<span>two<br> line</span>
<span><span>two <br> line (inline-block)</span></span>
</div>
</div>
baseline (with overflow:hidden)
<div class="table">
<div>
<span>one line</span>
<span><span style="overflow:hidden;">two <br> line</span></span>
</div>
</div>
baseline (with overflow:hidden)
<div class="table">
<div>
<span>one line</span>
<span><span style="overflow:hidden;">another line</span></span>
</div>
</div>
top will fix all the cases
<div class="table">
<div>
<span style="vertical-align:top;">one line</span>
<span><span>two <br> line</span></span>
</div>
</div>
<div class="table">
<div>
<span style="vertical-align:top;">one line</span>
<span><span style="overflow:hidden;">two <br> line</span></span>
</div>
</div>
<div class="table">
<div>
<span style="vertical-align:top;">one line</span>
<span><span style="overflow:hidden;">another line</span></span>
</div>
</div>
<div class="table">
<div>
<span style="vertical-align:top;">two<br> line</span>
<span><span>two <br> line (inline-block)</span></span>
</div>
</div>
You can clearly see how the use of inline-block (and overflow:hidden) is the culprit here as it make the calculation of the baseline counter intuitive and unexpected.
I see that Temani Afif has already provided solution to your original problem. But in case if it helps you in anyway or anyone else, here is the basic structure of a table with sub-tables
Styles
<style>
.table {
display:table; border:1px solid #ccc; border-collapse:collapse
}
.table .row {
display:table-row; border:1px solid #ccc; border-collapse:collapse
}
.table .row .headercell {
display:table-cell; border:1px solid #ccc; height: 80px; width: 150px; border-collapse:collapse
}
.table .row .cell {
display:table-cell; border:1px solid #ccc; height: 80px; Width: 300px; border-collapse:collapse
}
</style>
Table structure
<div class="table">
<div class="row">
<div class="headercell">
Row1
</div>
<div class="cell">
<div class="table">
<div class="row">
<div class="cell">
Cell1
</div>
<div class="cell">
Cell2
</div>
</div>
<div class="row">
<div class="cell">
Cell3
</div>
<div class="cell">
Cell4
</div>
</div>
</div>
</div>
</div>
<div class="row">
<div class="headercell">
Row2
</div>
<div class="cell">
<div class="table">
<div class="row">
<div class="cell">
Cell1
</div>
<div class="cell">
Cell2
</div>
</div>
<div class="row">
<div class="cell">
Cell3
</div>
<div class="cell">
Cell4
</div>
</div>
</div>
</div>
</div>
</div>
Related
p{
margin:0; padding:0;
}
.table {
display:table;
}
.headers, .row {
display:table-row;
}
.value, .header {
display:table-cell;
white-space:nowrap;
}
.value a, .header {
padding:10px;
}
.value a {
background-color:#9a9;
display:block;
}
.spacer {
width:100%;
}
<h1>
My Fruit Stores
</h1>
<div class="table">
<div class="headers">
<div class="header">
<p>Name</p>
</div>
<div class="header">
<p>Money</p>
</div>
<div class="header">
<p>Employees</p>
</div>
</div>
<div class="row">
<div class="value">
Store 1
</div>
<div class="value">
$1,800
</div>
<div class="value">
16
</div>
<div class="value spacer">
</div>
</div>
<div class="row">
<div class="value">
Store 2
</div>
<div class="value">
$800
</div>
<div class="value">
6
</div>
<div class="value spacer">
</div>
</div>
</div>
I have yet to get this link tag to take up all of the space of the table cell.
The idea here is that the entire row would be a link to the same place. I need the table to take up the width of its container so that is why I have this '.spacer' div.
So in my example you would click anywhere on the table row in order to get to a page about the store that the row represents.
Thanks.
EDIT: To be more clear, the problem is most specifically about the purposefully empty .spacer item that is being used to fill the remainder of the space to the right of the table row. If you look at this last table cell item you can see that it's height is not the same height as the rest of the table cells. I would like for the last '.spacer' item to fill up all of the space so it looks like a proper table.
You can add a whitespace within the empty anchor tag and set the text-decoration: none for .space a css selector
p{
margin:0; padding:0;
}
.table {
display:table;
}
.headers, .row {
display:table-row;
}
.value, .header {
display:table-cell;
white-space:nowrap;
}
.value a, .header {
padding:10px;
}
.value a {
background-color:#9a9;
display:block;
}
.spacer {
width:100%;
}
.spacer a{
text-decoration: none;
}
<h1>
My Fruit Stores
</h1>
<div class="table">
<div class="headers">
<div class="header">
<p>Name</p>
</div>
<div class="header">
<p>Money</p>
</div>
<div class="header">
<p>Employees</p>
</div>
</div>
<div class="row">
<div class="value">
Store 1
</div>
<div class="value">
$1,800
</div>
<div class="value">
16
</div>
<div class="value spacer">
</div>
</div>
<div class="row">
<div class="value">
Store 2
</div>
<div class="value">
$800
</div>
<div class="value">
6
</div>
<div class="value spacer">
</div>
</div>
</div>
Alternatively you could set the a within spacer to position:absolute and set its height & width to 100% as below
p{
margin:0; padding:0;
}
.table {
display:table;
}
.headers, .row {
display:table-row;
}
.value, .header {
display:table-cell;
white-space:nowrap;
}
.value a, .header {
padding:10px;
}
.value a {
background-color:#9a9;
display:block;
}
.spacer {
width:100%;
position: relative;
}
.spacer a{
position: absolute;
width: 100%;
height: 100%;
padding: 0;
}
<h1>
My Fruit Stores
</h1>
<div class="table">
<div class="headers">
<div class="header">
<p>Name</p>
</div>
<div class="header">
<p>Money</p>
</div>
<div class="header">
<p>Employees</p>
</div>
</div>
<div class="row">
<div class="value">
Store 1
</div>
<div class="value">
$1,800
</div>
<div class="value">
16
</div>
<div class="value spacer">
</div>
</div>
<div class="row">
<div class="value">
Store 2
</div>
<div class="value">
$800
</div>
<div class="value">
6
</div>
<div class="value spacer">
</div>
</div>
</div>
How can I design this image below using Bootstrap 3.3.6, those are div CSS? I am just a new programmer, hope you can help me.
Here's what you can do using divs.
<html>
<head>
<body>
<div style="border:3px solid black; width:auto; padding:10px;">
<div style="border:3px solid blue; width:auto; padding:10px; text-align:center;">
<div style="width:100px; display:inline-block; border:3px solid pink; margin:10px; height:10px; padding:10px;">
</div>
<div style="width:100px; display:inline-block; border:3px solid green; margin:10px; height:10px; padding:10px;">
</div>
</div>
</div>
</body>
</head>
<html>
To get the two inner-most divs floating side-by-side, we use display:inline-block; property.
use this. this is a bootstrap code.
<div class="container">
<div class="row">
<div class="col-md-6"></div>
<div class="col-md-6"></div>
</div>
</div>
Your structure should look like that :
<div class="container">
<div class="row">
<div class="div-1 col-md-12">
<div class="div-2 col-md-12">
<div class="div-3 col-md-6">
</div>
<div class="div-4 col-md-6">
</div>
</div>
</div>
</div>
</div>
After that the css will do the trick
So I'm trying to create a div that displays and image and has a title of the image at the bottom. The image should be have enough room so that it isn't stretched and look weird.Then I want to take that div and reproduce it over and over for as many images as I have.
I drew and image of what I'm trying! to describe I hope you guys and understand it.
This is the code I have so far. I know its not a lot but I'm a little lost.
.box{
height:250px;
width:200px;
margin-top:10px;
margin-right:15px;
margin-left:15px;
margin-bottom:10px;
float:left;
background-color:yellow;
}
.photo-div{
height:50px;
width:50px;
background-color:blue;
}
.title-wrap{
height:40px;
width: 200px;
background:pink;
}
<div class="box">
<div class="photo-div">
</div>
<div class="title-wrap">
</div>
</div>
Looking for something like this?
.box{
height:250px;
width:200px;
margin-top:10px;
margin-right:15px;
margin-left:15px;
margin-bottom:10px;
float:left;
background-color:yellow;
}
.row{
height:70px;
width:200px;
display: inline;
}
.column{
height:70px;
width:50px;
display: inline;
float:left;
}
.photo-div{
height:50px;
width:50px;
background-color:blue;
}
.title-wrap{
height:20px;
width: 50px;
background:pink;
text-align: center;
}
<div class="box">
<div class="row">
<div class="column">
<div class="photo-div">
<img src="https://cdn4.iconfinder.com/data/icons/pretty_office_3/48/Globe.png"/>
</div>
<div class="title-wrap">IMG</div>
</div>
<div class="column">
<div class="photo-div">
<img src="https://cdn4.iconfinder.com/data/icons/pretty_office_3/48/Globe.png"/>
</div>
<div class="title-wrap">IMG</div>
</div>
<div class="column">
<div class="photo-div">
<img src="https://cdn4.iconfinder.com/data/icons/pretty_office_3/48/Globe.png"/>
</div>
<div class="title-wrap">IMG</div>
</div>
<div class="column">
<div class="photo-div">
<img src="https://cdn4.iconfinder.com/data/icons/pretty_office_3/48/Globe.png"/>
</div>
<div class="title-wrap">IMG</div>
</div>
</div>
<div class="row">
<div class="column">
<div class="photo-div">
<img src="https://cdn4.iconfinder.com/data/icons/pretty_office_3/48/Globe.png"/>
</div>
<div class="title-wrap">IMG</div>
</div>
<div class="column">
<div class="photo-div">
<img src="https://cdn4.iconfinder.com/data/icons/pretty_office_3/48/Globe.png"/>
</div>
<div class="title-wrap">IMG</div>
</div>
<div class="column">
<div class="photo-div">
<img src="https://cdn4.iconfinder.com/data/icons/pretty_office_3/48/Globe.png"/>
</div>
<div class="title-wrap">IMG</div>
</div>
<div class="column">
<div class="photo-div">
<img src="https://cdn4.iconfinder.com/data/icons/pretty_office_3/48/Globe.png"/>
</div>
<div class="title-wrap">IMG</div>
</div>
</div>
</div>
try this
http://jsfiddle.net/jtx16Lf2/7/
<div id="main">
<div id="box">
<script>
for(var i=0;i<3;i++){
var image = document.createElement('div');
var titleBar = document.createElement('div');
image.className = "photo-div";
titleBar.className = "title-wrap";
document.getElementById('box').appendChild(image);
document.getElementById('box').appendChild(titleBar);
}
</script>
</div>
</div>
CSS
#box{
height:750px;
width:200px;
margin-top:10px;
margin-right:15px;
margin-left:15px;
margin-bottom:10px;
float:left;
background-color:yellow;
position:relative;
}
.photo-div{
height:50px;
width:50px;
background-color:blue;
margin-left:35%;
margin-top:20%;
float:left;
position:relative;
}
.title-wrap{
height:40px;
width: 200px;
background:pink;
margin-top:105%;
position:relative;
}
I have the following html:
<div class="container">
<div class="row">
<div class="col-md-2">
<div class="phone-and-email">
<p>+44 (0)7950 123 456 info#example.co.uk</p>
</div>
</div>
<div class="col-md-10">
<div class="icons">
<div class="row">
<div class="col-md-4">
<img src="images/info.png" class="pull-left"/>
<p>How to buy</p>
</div>
<div class="col-md-4">
<img src="images/delivery.png" class="pull-left"/>
<p>Free Delivery</p>
</div>
<div class="col-md-4">
<img src="images/gift.png" class="pull-left"/>
<p>Gift Vouchers</p>
</div>
</div>
</div>
</div>
</div>
</div>
css:
.phone-and-email, .icons {
border-top: 2px black solid;
border-bottom: 2px black solid;
}
I can't make the left column the same height as the right, and I have tried about 5 different solutions. It does work using javascript but I'd rather use css if possible.
How it looks:
How it should look:
One possible solution is to make use of display table for the row and table-cell to achieve the equal height of both grid sections.
Check this bootply.
HTML:
<div class="container">
<div id="onerow" class="row">
<div class="col-md-2 sameheight">
<div class="phone-and-email">
<p>+44 (0)7950 123 456 info#example.co.uk</p>
</div>
</div>
<div class="col-md-10 sameheight icons">
<div>
<div class="col-md-4">
<img src="http://www.bootply.com/assets/i_lovebootstrap.png" class="pull-left">
<p>How to buy</p>
</div>
<div class="col-md-4">
<img src="http://www.bootply.com/assets/i_lovebootstrap.png" class="pull-left">
<p>Free Delivery</p>
</div>
<div class="col-md-4">
<img src="http://www.bootply.com/assets/i_lovebootstrap.png" class="pull-left">
<p>Gift Vouchers</p>
</div>
</div>
</div>
</div>
</div>
CSS:
.phone-and-email, .icons {
border-top: 2px black solid;
border-bottom: 2px black solid;
}
img{
height:20px;
width:20px;
}
#onerow{
display: table;
}
.sameheight {
float: none;
display: table-cell;
vertical-align: top;
}
and thanks for the help.
I am having a somewhat confusing issue with IE7 when using margins.
I have a contaner, and inside that container I have some floated boxes.
These boxes have margins applied, top, right, left, bottom, except the first box that has no margin on the left, and the last box that has no margin on the right.
Looks fine in all browsers except IE7, where the margin is not applying for the first element in each row (at least this is what I think is happening.
If I remove margin right in ie7 using the dev tools and then check it back on it displays correctly.
Has anyone seen anything like this before?
I am stumped.
EDIT
It appears to being caused by position:relative on the container divs. Changing this back to static fixes the margin issue, but now means my divs are mis aligned in ie7. Does anyone know why position relative would screw up margins??
NEW EDIT
Example download can be found here:
www.jimplode.co.uk/content/stackoverflow.zip
Incorrect view
Correct Margins, after unchecking and rechecking just one of the margin styles.
The HTML:
<div class="lowerContent">
<div class="mediumContentBox contentBoxMarginTop contentBoxMarginRight contentBoxMarginBottom">
<div class="expandableBox">
<div class="topLeft">
<div class="topRight">
<div class="top"></div>
</div>
</div>
<div class="middleLeft">
<div class="middleRight">
<div class="middle">
<img src="/images/frame/transparent.gif" alt="spacer"width="0" height="215" class="fl" />
<div class="textContainer">
<h1>Car Insurance</h1>
<ul>
<li>Protected NCD for life</li>
<li>NCD Accelerator</li>
<li>European Cover Included</li>
<li>Multiple Drivers and Vehicles</li>
<li>Breakdown Cover Included</li>
<li>Legal Cover Included</li>
</ul>
<div class="boxButtons">
<a class="smallButtonLeft" href="#"><span>GET A QUOTE</span></a><a class="smallButtonRight" href="#"><span>FIND OUT MORE</span></a>
</div>
</div>
<div class="imageContainer">
<img src="/images/misc/boxphoto_1.jpg" alt="box image 0" />
</div>
<div class="emptyClear"></div>
</div>
</div>
</div>
<div class="bottomLeft">
<div class="bottomRight">
<div class="bottom">
</div>
</div>
</div>
</div>
</div>
<div class="smallContentBox contentBoxMarginTop contentBoxMarginLeft contentBoxMarginRight contentBoxMarginBottom">
<div class="expandableBox">
<div class="topLeft">
<div class="topRight">
<div class="top"></div>
</div>
</div>
<div class="middleLeft">
<div class="middleRight">
<div class="middle">
<img src="/images/frame/transparent.gif" alt="spacer"width="0" height="215" class="fl" />
<div class="textContainer">
<h2>Home Insurance</h2>
<div class="imageContainer">
<img src="/images/misc/boxphoto_2.jpg" alt="box image 2" />
</div>
<ul>
<li>Working at home Equipment</li>
<li>Helmet and Leathers</li>
<li>Legal Cover</li>
<li>Caravan Cover</li>
<li>Personal Accident Cover</li>
</ul>
<div class="boxButtons">
<a class="smallButtonLeft" href="#"><span>GET A QUOTE</span></a><a class="smallButtonRight" href="#"><span>FIND OUT MORE</span></a>
</div>
</div>
<div class="emptyClear"></div>
</div>
</div>
</div>
<div class="bottomLeft">
<div class="bottomRight">
<div class="bottom">
</div>
</div>
</div>
</div>
</div>
<div class="smallContentBox contentBoxMarginTop contentBoxMarginLeft contentBoxMarginBottom">
<div class="expandableBox">
<div class="topLeft">
<div class="topRight">
<div class="top"></div>
</div>
</div>
<div class="middleLeft">
<div class="middleRight">
<div class="middle">
<img src="/images/frame/transparent.gif" alt="spacer"width="0" height="215" class="fl" />
<div class="textContainer">
<h2>Life Insurance</h2>
<div class="imageContainer">
<img src="/images/misc/boxphoto_3.jpg" alt="box image 3" />
</div>
<ul>
<li>Cover From £5 a month</li>
<li>Your loved ones protected</li>
<li>Immediate cover available</li>
<li>We search, you save</li>
</ul>
<div class="boxButtons">
<a class="smallButtonLeft" href="#"><span>GET A QUOTE</span></a><a class="smallButtonRight" href="#"><span>FIND OUT MORE</span></a>
</div>
</div>
<div class="emptyClear"></div>
</div>
</div>
</div>
<div class="bottomLeft">
<div class="bottomRight">
<div class="bottom">
</div>
</div>
</div>
</div>
</div>
<div class="emptyClear"></div>
<div class="smallContentBox contentBoxMarginTop contentBoxMarginRight">
<div class="expandableBox">
<div class="topLeft">
<div class="topRight">
<div class="top"></div>
</div>
</div>
<div class="middleLeft">
<div class="middleRight">
<div class="middle">
<img src="/images/frame/transparent.gif" alt="spacer"width="0" height="140" class="fl" />
<div class="imageContainerAlternate">
<img src="/images/misc/boxphoto_4.jpg" alt="box image 4" />
</div>
<div class="boxButtons">
<a class="smallButtonLeft" href="#"><span>GET A QUOTE</span></a><a class="smallButtonRight" href="#"><span>FIND OUT MORE</span></a>
</div>
<div class="emptyClear"></div>
</div>
</div>
</div>
<div class="bottomLeft">
<div class="bottomRight">
<div class="bottom">
</div>
</div>
</div>
</div>
</div>
<div class="smallContentBox contentBoxMarginTop contentBoxMarginRight contentBoxMarginLeft">
<div class="expandableBox">
<div class="topLeft">
<div class="topRight">
<div class="top"></div>
</div>
</div>
<div class="middleLeft">
<div class="middleRight">
<div class="middle">
<img src="/images/frame/transparent.gif" alt="spacer"width="0" height="140" class="fl" />
<div class="imageContainerAlternate">
<img src="/images/misc/boxphoto_5.jpg" alt="box image 5" />
</div>
<div class="boxButtons">
<a class="smallButtonLeft" href="#"><span>GET A QUOTE</span></a><a class="smallButtonRight" href="#"><span>FIND OUT MORE</span></a>
</div>
<div class="emptyClear"></div>
</div>
</div>
</div>
<div class="bottomLeft">
<div class="bottomRight">
<div class="bottom">
</div>
</div>
</div>
</div>
</div>
<div class="smallContentBox contentBoxMarginTop contentBoxMarginRight contentBoxMarginLeft">
<div class="expandableBox">
<div class="topLeft">
<div class="topRight">
<div class="top"></div>
</div>
</div>
<div class="middleLeft">
<div class="middleRight">
<div class="middle">
<img src="/images/frame/transparent.gif" alt="spacer"width="0" height="140" class="fl" />
<div class="imageContainerAlternate">
<img src="/images/misc/boxphoto_6.jpg" alt="box image 6" />
</div>
<div class="boxButtons">
<a class="smallButtonLeft" href="#"><span>GET A QUOTE</span></a><a class="smallButtonRight" href="#"><span>FIND OUT MORE</span></a>
</div>
<div class="emptyClear"></div>
</div>
</div>
</div>
<div class="bottomLeft">
<div class="bottomRight">
<div class="bottom">
</div>
</div>
</div>
</div>
</div>
<div class="smallContentBox contentBoxMarginTop contentBoxMarginLeft">
<div class="expandableBox">
<div class="topLeft">
<div class="topRight">
<div class="top"></div>
</div>
</div>
<div class="middleLeft">
<div class="middleRight">
<div class="middle">
<img src="/images/frame/transparent.gif" alt="spacer"width="0" height="140" class="fl" />
<div class="imageContainerAlternate">
<img src="/images/misc/boxphoto_7.jpg" alt="box image 7" />
</div>
<div class="boxButtons">
<a class="smallButtonLeft" href="#"><span>GET A QUOTE</span></a><a class="smallButtonRight" href="#"><span>FIND OUT MORE</span></a>
</div>
<div class="emptyClear"></div>
</div>
</div>
</div>
<div class="bottomLeft">
<div class="bottomRight">
<div class="bottom">
</div>
</div>
</div>
</div>
</div>
<div class="emptyClear"></div>
</div>
The CSS:
.lowerContent
{
position:relative;
margin:0px 0px 0px 0px;
}
.expandableBox
{
display:block;
width:100%;
}
.expandableBox .top
{
background-image:url("/images/backgrounds/bkg_whitebox_t.png");
background-repeat: repeat-x;
height:10px;
}
.expandableBox .topLeft
{
height:10px;
padding:0px 0px 0px 10px;
background-image:url("/images/backgrounds/bkg_whitebox_tl.png");
background-repeat: no-repeat;
background-position:left top;
}
.expandableBox .topRight
{
height:10px;
padding:0px 10px 0px 0px;
background-image:url("/images/backgrounds/bkg_whitebox_tr.png");
background-repeat: no-repeat;
background-position:right top;
}
.expandableBox .middleLeft
{
padding:0px 0px 0px 10px;
background-image:url("/images/backgrounds/bkg_whitebox_l.png");
background-repeat: repeat-y;
background-position:left top;
}
.expandableBox .middle
{
background-color:#FFFFFF;
}
.expandableBox .middleRight
{
padding:0px 10px 0px 0px;
background-image:url("/images/backgrounds/bkg_whitebox_r.png");
background-repeat: repeat-y;
background-position:right top;
}
.expandableBox .bottom
{
background-image:url("/images/backgrounds/bkg_whitebox_b.png");
background-repeat: repeat-x;
background-position:bottom;
height:10px;
margin-bottom:7px;
}
.expandableBox .bottomLeft
{
height:10px;
padding:0px 0px 0px 10px;
background-image:url("/images/backgrounds/bkg_whitebox_bl.png");
background-repeat: no-repeat;
background-position:left bottom;
}
.expandableBox .bottomRight
{
height:10px;
padding:0px 10px 0px 0px;
background-image:url("/images/backgrounds/bkg_whitebox_br.png");
background-repeat: no-repeat;
background-position:right bottom;
}
.contentBoxMarginLeft
{
margin-left:10px;
}
.contentBoxMarginRight
{
margin-right:10px;
}
.contentBoxMarginTop
{
margin-top:10px;
}
.contentBoxMarginBottom
{
margin-bottom:10px;
}
.fullContentBox
{
width:940px;
float:left;
}
.largeContentBox
{
width:700px;
float:left;
}
.mediumContentBox
{
width:460px;
float:left;
}
.smallContentBox
{
width:220px;
float:left;
}
.mediumContentBox .textContainer
{
float:left;
width:210px;
}
.mediumContentBox .imageContainer
{
float:right;
width:210px;
}
.smallContentBox .textContainer
{
}
.smallContentBox .textContainer .imageContainer
{
float:right;
padding:5px 0px 0px 0px;
}
.smallContentBox .imageContainerAlternate
{
float:left;
padding:0px 0px 0px 0px;
}
a.smallButtonLeft,
a.smallButtonRight
{
display:inline-block;
background-image:url('/images/backgrounds/bkg_sprites_buttons.png');
height:30px;
background-position:left top;
background-repeat:no-repeat;
padding:0px 10px;
line-height:23px;
color: #0F4DBC;
font-family: Arial,Helvetica,sans-serif;
font-weight: bold;
text-decoration: none;
text-transform: capitalize;
}
a.smallButtonLeft:hover
{
background-position:left -44px;
}
a.smallButtonRight
{
background-position:right -217px;
color: #4D4F52;
}
a.smallButtonRight:hover
{
background-position:right -262px;
}
.boxButtons
{
float:left;
padding:10px 0px 0px 0px;
}
.smallContentBox .boxButtons
{
width:200px;
text-align:center;
}
Thanks in advance.
Could be something to do with margins collapsing. I would tempted to only have the margin on the left, then margin-left:0 on the first one.
Alternatively, try our old friend "zoom:1" on the floated divs or the parent container. Often fixes a lot of the more obscure IE weirdness.