Why do I get wrong alignment in this if I use bootstrap? - html

If I use bootstrap, it messes the alignment up on my page. Member names should be appeared right next to icon, but with Bootstrap, they overlap the icon.
How can I fix this?
Also, when the browser window is made smaller, the square line gets messed up too. I want the data to have a border when the window is small.
So I don't want it to look like this:
But rather, like this:
If possible I want to have these icon, and name in middle not on the top.
DEMO http://jsfiddle.net/sbq7X/
HTML
<div class="store_row">
<div class="store_left">
<div class="store_title">walmart</div>
<div class="store_location">Located in California</div>
</div>
<div class="store_right">
<div class="store_icon">
<img class="img-polaroid" src="http://www.miraiha.net/wpblog/wp-content/uploads/2010/10/designreviver-free-twitter-social-icon-300x266.jpg" />
</div>
<div class="introduction">
<div class="name1">John Tailor</div>
<div class="name2">Mike Smith</div>
<div class="name3">Jessica Swan</div>
</div>
</div>
</div>
<div class="store_row">
<div class="store_left">
<div class="store_title">walmart</div>
<div class="store_location"><span class='text-error'>Located in California</span></div>
</div>
<div class="store_right">
<div class="store_icon">
<img class="img-polaroid" src="http://media-cache-ec1.pinterest.com/avatars/walmarthub-1349815045_600.jpg" />
</div>
<div class="introduction">
<div class="name1">John Tailor</div>
<div class="name2">Mike Smith</div>
<div class="name3">Jessica Swan</div>
</div>
</div>
CSS
div.store_row{
min-width: 300px;
margin-bottom: 20px;
margin-left: 10px;
margin-right: 10px;
border:1px solid;
display:table;
}
div.store_left{
width: 300px;
display:inline-block;
vertical-align:top;
}
div.store_right{
width: 300px;
display:inline-block;
vertical-align:top;
background-color: #FFFFFF;
}
div.store_title{
background-color: #000000;
color: #FFFFFF;
height: 35px;
padding:5px;
}
div.store_location{
height: 35px;
border-right:1px solid;
background-color: #FFFFFF;
padding:5px;
}
div.store_icon{
width: 70px;
height: 70px;
display:inline-block;
}
div.store_icon img{
width:100%;
height:100%;
}
div.introduction{
display:inline-block;
vertical-align:top;
width:200px;
text-align: left;
}
.... and bootstrap

img-polaroid class has 4px padding and it causes the problem:
.img-polaroid {
padding: 4px;
background-color: #fff;
border: 1px solid #ccc;
border: 1px solid rgba(0, 0, 0, 0.2);
-webkit-box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
-moz-box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}
See the fiddle where it's removed.
EDIT: The alignment is working fine as well. You have static width for the all elements and they're too wide for fiddle. I've decreased their size so they are inline now.

Related

Overlapping Divs in HTML [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 6 years ago.
Improve this question
I want the Divs to work relative to each other. The divs are overlapping when I add rows in gridview. You can see the problem in the image. I am not good at html/css. Kindly help me out.
This is the HTML:
<section id="section-1" class="content-current" onclick="setTabIndex(1)">
<div class="left-side">
<div class="women_main">...</div>
<br />
</div>
<div class="right-side">
<div class="w_content">...</div>
</div>
<br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br />
<div class="women_main">...</div>
</section>
CSS:
.right-side {
width:50%;
float:right;
margin-top:0px;
padding-top:0px;
}
.left-side{
width:50%;
float:left;
}
.women_main {
-webkit-box-shadow: 0px 0px 2px 1px rgba(37, 37, 37, 0.39);
box-shadow: 0px 0px 2px 1px rgba(37, 37, 37, 0.39);
padding: 1em;
border: 2px solid #e3e3e3 !important;
}
You should really clear the floats. Don't give so many <br /> for getting to the right layout. The solution is to use clear: both on the .women_main.
Initial Look:
.right-side {
width: 50%;
float: right;
margin-top: 0px;
padding-top: 0px;
}
.left-side {
width: 50%;
float: left;
}
.women_main {
clear: both;
-webkit-box-shadow: 0px 0px 2px 1px rgba(37, 37, 37, 0.39);
box-shadow: 0px 0px 2px 1px rgba(37, 37, 37, 0.39);
padding: 1em;
border: 2px solid #e3e3e3 !important;
}
<section id="section-1" class="content-current" onclick="setTabIndex(1)">
<div class="left-side">
<div class="women_main">...</div>
<br />
</div>
<div class="right-side">
<div class="w_content">...</div>
</div>
<div class="women_main">...</div>
</section>
When the right side is too long:
.right-side {
width: 50%;
float: right;
margin-top: 0px;
padding-top: 0px;
height: 600px;
}
.left-side {
width: 50%;
float: left;
}
.women_main {
clear: both;
-webkit-box-shadow: 0px 0px 2px 1px rgba(37, 37, 37, 0.39);
box-shadow: 0px 0px 2px 1px rgba(37, 37, 37, 0.39);
padding: 1em;
border: 2px solid #e3e3e3 !important;
}
<section id="section-1" class="content-current" onclick="setTabIndex(1)">
<div class="left-side">
<div class="women_main">...</div>
<br />
</div>
<div class="right-side">
<div class="w_content">...</div>
</div>
<div class="women_main">...</div>
</section>
You could find that both adapt correctly to the height.
I have worked out on your code and attached herewith the codepen link. Please check, I hope this will help you.
HTML
<section id="section-1" class="content-current" onclick="setTabIndex(1)">
<div class="left-side">
<div class="women_main">... LEFT CONTENT ...</div>
</div>
<div class="right-side">
<div class="women_main">... RIGHT CONTENT ...</div>
</div>
</section>
<section class="two">
<div class="">... SECTION2 ...</div>
</section>
CSS
.content-current, .two {
width: 100%;
position: relative;
border:1px solid #000;
height:100px;
}
.left-side {
width: 49%;
float: left;
border: 1px solid red;
}
.right-side {
width: 49%;
float: right;
border: 1px solid blue;
}
.women_main {
-webkit-box-shadow: 0px 0px 2px 1px rgba(37, 37, 37, 0.39);
box-shadow: 0px 0px 2px 1px rgba(37, 37, 37, 0.39);
padding: 1em;
border: 2px solid #e3e3e3 !important;
}
.content-current:after {
clear:both;
}
.two {
margin-top: 10px;
background: #ccc;
}
http://codepen.io/WebTechie/pen/EZxNwJ

What i am doing wrong in table with divs

What i am doing wrong with this table constructed with divs?
Why header row and cell row don't have the same width?
Another problem is, when resizing browser window header an cell losing their justify. I'd like to have the same movement for both header and cells.
if you resize your browser window you will see borders moving different.
here is my code
html, body {
width: 100%;
height: 95vh;
overflow: hidden;
background-color: rgba(31, 30, 30, 1);
}
.records {
width: 99%;
overflow-x: hidden;
overflow-y: auto;
}
.header-cell {
display: inline-block;
width: 9%;
height: 20px;
margin-top: 2px;
margin-left: -4px;
border: 1px solid #fff;
background: #3a3a3a;
color: #fff;
white-space: nowrap;
}
.cell {
display: inline-block;
width: 9%;
height: 20px;
margin-top: 2px;
margin-left: -4px;
border: 1px solid #fff;
background: #ccc;
color: #494949;
white-space: nowrap;
}
.header {
position: fixed;
width: 100%;
}
.row1 {
padding-top: 4px;
}
/* scrollbars */
::-webkit-scrollbar {
width: 5px;
}
::-webkit-scrollbar-track {
-webkit-border-radius: 10px;
-webkit-box-shadow: inset 0 0 6px rgba(0, 0, 0, .3);
border-radius: 10px;
}
::-webkit-scrollbar-thumb {
-webkit-border-radius: 10px;
-webkit-box-shadow: inset 0 0 6px rgba(0, 0, 0, .5);
border-radius: 10px;
background: rgba(204, 51, 0, .9);
}
::-webkit-scrollbar-thumb:window-inactive {
background: rgba(255, 0, 0, .4);
}
/* scrollbars */
::-webkit-scrollbar {
width: 5px;
}
::-webkit-scrollbar-track {
-webkit-border-radius: 10px;
-webkit-box-shadow: inset 0 0 6px rgba(0, 0, 0, .3);
border-radius: 10px;
}
::-webkit-scrollbar-thumb {
-webkit-border-radius: 10px;
-webkit-box-shadow: inset 0 0 6px rgba(0, 0, 0, .5);
border-radius: 10px;
background: rgba(204, 51, 0, .9);
}
::-webkit-scrollbar-thumb:window-inactive {
background: rgba(255, 0, 0, .4);
}
<div class="records">
<div class="header">
<div class="header-cell">#</div>
<div class="header-cell">Movie</div>
<div class="header-cell">Distributor</div>
<div class="header-cell">Country</div>
<div class="header-cell">Language</div>
<div class="header-cell">Name</div>
<div class="header-cell">Role</div>
<div class="header-cell">Born</div>
<div class="header-cell">Star Sign</div>
<div class="header-cell">Episodes</div>
</div>
<div style="padding-top:19px;">
<div class="cell">145</div>
<div class="cell">Game Of Thrones</div>
<div class="cell">HBO</div>
<div class="cell">USA</div>
<div class="cell">English</div>
<div class="cell">
Peter Dinklage
</div>
<div class="cell">Tyrion Lannister</div>
<div class="cell">June 11, 1969</div>
<div class="cell">Gemini</div>
<div class="cell">2-3-4-6-11</div>
</div>
<div style="padding-top:1px;">
<div class="cell">146</div>
<div class="cell">Game Of Thrones</div>
<div class="cell">HBO</div>
<div class="cell">USA</div>
<div class="cell">English</div>
<div class="cell">
Kit Harington
</div>
<div class="cell">Jon Snow</div>
<div class="cell">December 26, 1986</div>
<div class="cell">Capricorn</div>
<div class="cell">1-2-3-6-9</div>
</div>
</div>
I have updated your html and styles, The width of the entries row and the float: left; used instead of display: inline-block;
HTML
<div class="records" >
<div class="header">
<div class="header-cell">#</div>
<div class="header-cell">Movie</div>
<div class="header-cell">Distributor</div>
<div class="header-cell">Country</div>
<div class="header-cell">Language</div>
<div class="header-cell">Name</div>
<div class="header-cell">Role</div>
<div class="header-cell">Born</div>
<div class="header-cell">Star Sign</div>
<div class="header-cell">Episodes</div>
</div>
<div style="padding-top:19px;width:100%">
<div class="cell">145</div>
<div class="cell">Game Of Thrones</div>
<div class="cell">HBO</div>
<div class="cell">USA</div>
<div class="cell">English</div>
<div class="cell">Peter Dinklage</div>
<div class="cell">Tyrion Lannister</div>
<div class="cell">June 11, 1969</div>
<div class="cell">Gemini</div>
<div class="cell">2-3-4-6-11</div>
</div>
<div style="padding-top:1px;width:100%">
<div class="cell">146</div>
<div class="cell">Game Of Thrones</div>
<div class="cell">HBO</div>
<div class="cell">USA</div>
<div class="cell">English</div>
<div class="cell">Kit Harington</div>
<div class="cell">Jon Snow</div>
<div class="cell">December 26, 1986</div>
<div class="cell">Capricorn</div>
<div class="cell">1-2-3-6-9</div>
</div>
</div>
Style
html,body {
width:100%;
height:95vh;
background-color: rgba(31,30,30,1);
overflow:hidden;
}
.records {
width:99%;
overflow-x:hidden;
overflow-y:auto;
}
.header-cell {
height: 20px;
width: 9%;
background: #3a3a3a;
color: #ffffff;
/* display: inline-block; */
/* margin-left: -4px; */
white-space: nowrap;
border: 1px solid #fff;
/* margin-top: 2px; */
float: left;
}
.cell {
height: 20px;
width: 9%;
background: #cccccc;
color: #494949;
/* display: inline-block; */
/* margin-left: -4px; */
float: left;
white-space: nowrap;
border: 1px solid #fff;
/* margin-top: 2px; */
}
.header {
/*position:fixed; */
width:100%;
}
.row1 {
padding-top:4px;
}
/* scrollbars */
::-webkit-scrollbar {width: 5px;}
::-webkit-scrollbar-track {-webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.3); -webkit-border-radius: 10px; border-radius: 10px;}
::-webkit-scrollbar-thumb {-webkit-border-radius: 10px; border-radius: 10px; background: rgba(204,51,0,0.9); -webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.5); }
::-webkit-scrollbar-thumb:window-inactive { background: rgba(255,0,0,0.4); }
/* scrollbars */
::-webkit-scrollbar {width: 5px;}
::-webkit-scrollbar-track {-webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.3); -webkit-border-radius: 10px; border-radius: 10px;}
::-webkit-scrollbar-thumb {-webkit-border-radius: 10px; border-radius: 10px; background: rgba(204,51,0,0.9); -webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.5); }
::-webkit-scrollbar-thumb:window-inactive { background: rgba(255,0,0,0.4); }
Refer the update fiddle :
https://jsfiddle.net/5Ldv5m1a/3/
This is a highly unconventional way of making a table. HTML has the <table> element where tables have <tr> (table row) elements and <td> (table cell) elements. The layout would look like this:
<table class="tabName">
<tr class="header">
<td>Element1</td>
<td>Element2</td>
<td>Element3</td>
<td>Element4</td>
</tr>
<tr>
<td>Element1</td>
<td>Element2</td>
<td>Element3</td>
<td>Element4</td>
</tr>
<tr>
<td>Element1</td>
<td>Element2</td>
<td>Element3</td>
<td>Element4</td>
</tr>
</table>
This will create 2 rows with 4 elements in each row excluding the header. Using the class name for the first table row, you can set special CSS specs on the header and other rules for the non-headers. If you want CSS rules for just the header use this:
.header td{
/*header styles*/
}
If you want to style the cells that are not part of the header use this CSS rule:
td:not(.header td){
/*non-header cell styles*/
}
For future reference, keep in mind that divs are only used to "package" a set of elements together when they share a common set of rules. So avoid rewriting the same rules for multiple elements by using the same class names for both or grouping them within a div. For example, if you have Ok and Cancel buttons together, you would put them inside a div because they will use exact same CSS rules except for the button color.
Try this
.records {
display: table;
overflow-x: hidden;
overflow-y: auto;
width: 100%;
}
.btlrow {
display: table-row;
}
.cell {
background: #cccccc none repeat scroll 0 0;
border: 1px solid #fff;
color: #494949;
display: table-cell;
height: 20px;
margin-top: 2px;
white-space: nowrap;
}
/* scrollbars */
::-webkit-scrollbar {width: 5px;}
::-webkit-scrollbar-track {-webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.3); -webkit-border-radius: 10px; border-radius: 10px;}
::-webkit-scrollbar-thumb {-webkit-border-radius: 10px; border-radius: 10px; background: rgba(204,51,0,0.9); -webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.5); }
::-webkit-scrollbar-thumb:window-inactive { background: rgba(255,0,0,0.4); }
/* scrollbars */
::-webkit-scrollbar {width: 5px;}
::-webkit-scrollbar-track {-webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.3); -webkit-border-radius: 10px; border-radius: 10px;}
::-webkit-scrollbar-thumb {-webkit-border-radius: 10px; border-radius: 10px; background: rgba(204,51,0,0.9); -webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.5); }
::-webkit-scrollbar-thumb:window-inactive { background: rgba(255,0,0,0.4); }
<div class="records" >
<div class="btlrow">
<div class="cell">#</div>
<div class="cell">Movie</div>
<div class="cell">Distributor</div>
<div class="cell">Country</div>
<div class="cell">Language</div>
<div class="cell">Name</div>
<div class="cell">Role</div>
<div class="cell">Born</div>
<div class="cell">Star Sign</div>
<div class="cell">Episodes</div>
</div>
<div class="btlrow">
<div class="cell">145</div>
<div class="cell">Game Of Thrones</div>
<div class="cell">HBO</div>
<div class="cell">USA</div>
<div class="cell">English</div>
<div class="cell">Peter Dinklage</div>
<div class="cell">Tyrion Lannister</div>
<div class="cell">June 11, 1969</div>
<div class="cell">Gemini</div>
<div class="cell">2-3-4-6-11</div>
</div>
<div class="btlrow">
<div class="cell">146</div>
<div class="cell">Game Of Thrones</div>
<div class="cell">HBO</div>
<div class="cell">USA</div>
<div class="cell">English</div>
<div class="cell">Kit Harington</div>
<div class="cell">Jon Snow</div>
<div class="cell">December 26, 1986</div>
<div class="cell">Capricorn</div>
<div class="cell">1-2-3-6-9</div>
</div>
</div>
Your code need few changes in the CSS file and few CSS changes in HTML file. Below are the changes.
HTML:
<div class="records" >
<div class="header">
<div class="header-cell">#</div>
<div class="header-cell">Movie</div>
<div class="header-cell">Distributor</div>
<div class="header-cell">Country</div>
<div class="header-cell">Language</div>
<div class="header-cell">Name</div>
<div class="header-cell">Role</div>
<div class="header-cell">Born</div>
<div class="header-cell">Star Sign</div>
<div class="header-cell">Episodes</div>
</div>
<div style="padding-top:19px;display: table-row;">
<div class="cell">145</div>
<div class="cell">Game Of Thrones</div>
<div class="cell">HBO</div>
<div class="cell">USA</div>
<div class="cell">English</div>
<div class="cell">Peter Dinklage</div>
<div class="cell">Tyrion Lannister</div>
<div class="cell">June 11, 1969</div>
<div class="cell">Gemini</div>
<div class="cell">2-3-4-6-11</div>
</div>
<div style="padding-top:1px;display: table-row;">
<div class="cell">146</div>
<div class="cell">Game Of Thrones</div>
<div class="cell">HBO</div>
<div class="cell">USA</div>
<div class="cell">English</div>
<div class="cell">Kit Harington</div>
<div class="cell">Jon Snow</div>
<div class="cell">December 26, 1986</div>
<div class="cell">Capricorn</div>
<div class="cell">1-2-3-6-9</div>
</div>
</div>
CSS:
html,body {width:100%;height:95vh;background-color: rgba(31,30,30,1); overflow:hidden;}
.records {width:99%; overflow-x:hidden; overflow-y:auto; display: table}
.header-cell {background:#3a3a3a;color:#ffffff;display:table-cell;border:1px solid #fff;}
.cell {background:#cccccc;color:#494949;display:table-cell;border:1px solid #fff;}
.header {display: table-row;}
.row1 {padding-top:4px;}
/* scrollbars */
::-webkit-scrollbar {width: 5px;}
::-webkit-scrollbar-track {-webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.3); -webkit-border-radius: 10px; border-radius: 10px;}
::-webkit-scrollbar-thumb {-webkit-border-radius: 10px; border-radius: 10px; background: rgba(204,51,0,0.9); -webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.5); }
::-webkit-scrollbar-thumb:window-inactive { background: rgba(255,0,0,0.4); }
/* scrollbars */
::-webkit-scrollbar {width: 5px;}
::-webkit-scrollbar-track {-webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.3); -webkit-border-radius: 10px; border-radius: 10px;}
::-webkit-scrollbar-thumb {-webkit-border-radius: 10px; border-radius: 10px; background: rgba(204,51,0,0.9); -webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.5); }
::-webkit-scrollbar-thumb:window-inactive { background: rgba(255,0,0,0.4); }

Can't move elements in css divs

For some reason I have a parent div called banner which contains a number of child divs, however in my css styles sheet I can't seem to move any elements especially the "CRAFT412" logo image to my desired position within the banner. I've tried using left/right/top/bottom to move these elements but nothing seems to budge them. If anyone could help me here I'd appreciative it.
Here is my HTML for a page on my site
<!--TOP BANNER SECTION-->
<div id="banner">
<div id="logo">
<img src="images/CRAFT412 - Logo.png" width="500" height="281" alt="CRAFT412">
</div>
<div id="ip_box"></div>
<div id="ip_text">
<p>SERVER IP<P/>
<p>craft412.serveminecraft.net<P/>
</div>
<div id="teamspeak_box"></div>
<div id="teamspeak_box_2"></div>
<div id="teamspeak_text">
<p>TEAMSPEAK<P/>
</div>
<div id="teamspeak_image">
<a href="ts3server://craft412.serveminecraft.net:9987">
<img src="images/CRAFT412 - Box - Teamspeak.png" alt="TEAMSPEAK">
</a>
</div>
</div>
Also here is my CSS for the same divs
/*CSS FOR ALL PAGES*/
/*BODY/WRAPPER SECTION*/
body {
background:#EEEEEE;
background-repeat: no-repeat;
background-attachment: fixed;
}
#wrapper {
width: 1750px;
margin: 0 auto;
background-color: white;
border-radius: 5px;
box-shadow: 0px 1.5px 2px 0px;
border: 1.5px solid #E0E0E0;
color: #E0E0E0;
}
/*TOP BANNER SECTION*/
#banner { height:100px; }
#logo {}
#ip_box {
width:200px;
height:43px;
background:#212121;
border-radius: 5px;
box-shadow: 1px 1px 5px;}
#ip_text {
color: white;
font-size: 15px;
}
#teamspeak_box {
width:159px;
height:43px;
background:#212121;
border-radius: 5px;
box-shadow: 1px 1px 5px;
}
#teamspeak_box_2 {
width:43px;
height:43px;
background:#313131;
border-radius: 5px 0px 0px 5px;
}
#teamspeak_text { color: white; }
#teamspeak_image {}
Give the parent div a property :
Position:relative;
Also give the property to child div:
Position:absolute;
Now you can change the places of child div inside the "BANNER" div. by using TOP , BOTTOM, RIGHT, LEFT

Unknown additional space on <div> top

I am creating a table madde with several divs, and I am having an extra space between the first row (styled as head) and the rest of them, only the fist two columns (divs). Here you can see very clear:
There is no style atribute causing this space, at least I am not able to find the reason of it.
I have reproduced it on jsfiddle and you can see that it also sets the extra space: DEMO
Here I bring HTML & Syle related code:
HTML:
<div class="tableWrap">
<div class="tableHeader">
<div class="contentColumn60">
<span class="tableHeaderText">Turno</span>
</div>
<div class="contentColumn20">
<span class="tableHeaderText">Tipo</span>
</div>
<div class="contentColumn10">
<span class="tableHeaderText">Editar</span>
</div>
<div class="contentColumn10">
<span class="tableHeaderText">Reactivar</span>
</div>
</div>
<div class="tableContent">
<div class="contentColumn60">
<span class="tableContentText">Mañana(17:00 - 21:00)</span>
</div>
<div class="contentColumn20">
<span class="tableContentText">Mañanas</span>
</div>
<div class="contentColumn10">
<div class="editIcon"></div>
</div>
<div class="contentColumn10">
<div class="discontinueIcon"></div>
</div>
</div>
<div class="tableContent">
<div class="contentColumn60">
<span class="tableContentText">Mañana(17:00 - 21:00)</span>
</div>
<div class="contentColumn20">
<span class="tableContentText">Mañanas</span>
</div>
<div class="contentColumn10">
<div class="editIcon"></div>
</div>
<div class="contentColumn10">
<div class="discontinueIcon"></div>
</div>
</div>
<div class="tableContent">
<div class="contentColumn60">
<span class="tableContentText">Mañana(17:00 - 21:00)</span>
</div>
<div class="contentColumn20">
<span class="tableContentText">Mañanas</span>
</div>
<div class="contentColumn10">
<div class="editIcon"></div>
</div>
<div class="contentColumn10">
<div class="discontinueIcon"></div>
</div>
</div>
STYLE:
.tableWrap{
width: 100%;
height:380px;
border:#ccc 1px solid;
border-radius:3px;
box-shadow: 0 1px 2px #d1d1d1;
margin: 10px;
background: -webkit-gradient(linear, left top, left bottom, from(#fbfbfb), to(#fafafa));
background: -moz-linear-gradient(top, #fbfbfb, #fafafa);
font-size:12px;
color:#666;}
.tableHeader{
height: 40px;
width: 100%;
background: -moz-linear-gradient(center top , #EDEDED, #EBEBEB) repeat scroll 0 0 rgba(0, 0, 0, 0);
border-bottom: 1px solid #E0E0E0;
border-left: 1px solid #E0E0E0;
border-top: 1px solid #FAFAFA;
display: inline-block;
font-weight: 600;
}
.tableHeaderText{
line-height: 40px;
padding: 0 10px;
}
.tableContent{
height: 40px;
width: 100%;
}
.tableContentText{
line-height: 40px;
padding: 0 0 0 20px;
}
.contentColumn60{
height: 40px;
width: 58%;
border-top:1px solid #fafafa;
border-bottom:1px solid #e0e0e0;
border-left:1px solid #e0e0e0;
display: inline-block;
}
.contentColumn20{
height: 40px;
width: 20%;
border-top:1px solid #fafafa;
border-bottom:1px solid #e0e0e0;
border-left:1px solid #e0e0e0;
display: inline-block;
}
.contentColumn10{
height: 40px;
width: 10%;
border-top:1px solid #fafafa;
border-bottom:1px solid #e0e0e0;
border-left:1px solid #e0e0e0;
display: inline-block;
}
.discontinueIcon{
width: 23px;
height: 23px;
background-size: 98%;
background-image: url(images/error.png);
background-repeat:no-repeat;
margin: 0 auto;
}
.editIcon{
width: 23px;
height: 23px;
background-size: 98%;
background-image: url(images/edit.png);
background-repeat:no-repeat;
margin: 0 auto;
}
Since the elements are inline-block, you could use vertical-align:top to align them as desired. It's worth noting that the default property value is baseline; this explains why they were behaving as they were. UPDATED EXAMPLE HERE
.contentColumn60 {
height: 40px;
width: 58%;
border-top: 1px solid #fafafa;
border-bottom: 1px solid #e0e0e0;
border-left: 1px solid #e0e0e0;
display: inline-block;
vertical-align: top;
}
.contentColumn20 {
height: 40px;
width: 20%;
border-top: 1px solid #fafafa;
border-bottom: 1px solid #e0e0e0;
border-left: 1px solid #e0e0e0;
display: inline-block;
vertical-align: top;
}
use overflow:hidden; for content column60,20,10 it works perfect
add a clearfix or use vertical-align:top and overflow:hidden
.contentColumn60:after {
content: "";
display: table;
clear: both;
}

How To Have Multiple Divs On One Line With Even Spacing

Trying to get multiple divs on the same line with even spacing. So they nicely fit the whole container.
Here is what i have got so far. Tried to set margin right and left equal to the same on all the boxes, but it is still tricky to make it even and sometimes the final box will go on a new line.
HTML
<div id="serviceBox">
<div class="serviceBox1">
<h2> Heading 1</h2>
<p>Information</p>
</div>
<div class="serviceBox2">
<h2>Heading 2</h2>
<p> Information</p>
</div>
<div class="serviceBox3">
<h2>Heading 3</h2>
<p>Information</p>
</div>
<div class="serviceBox4">
<h2>Heading 4</h2>
<p>Information</p>
</div>
</div>
CSS
#serviceBox
{
width:100%;
margin: 0 auto;
margin-top:75px;
height:250px;
border:1px solid black;
}
.serviceBox1, .serviceBox2, .serviceBox3, .serviceBox4 {
float:left;
width:20%;
height: 250px;
background-color: white;
border: 1px solid #bdbdbd;
-webkit-border-radius: 5px;
border-radius: 5px;
-moz-box-shadow: 0 0 10px #bdbdbd;
-webkit-box-shadow: 0 0 10px #bdbdbd;
box-shadow: 0 0 10px #bdbdbd;
}
https://jsfiddle.net/ruJ2R/3/
I would suggest adding a new element inside each serviceBox, in this example the div with class box
CSS:
#serviceBox
{
width:100%;
margin: 0 auto;
margin-top:75px;
height:250px;
border:1px solid black;
}
.serviceBox1, .serviceBox2, .serviceBox3, .serviceBox4 {
float:left;
width:25%;
}
.box{
height: 250px;
background-color: white;
border:1px solid #bdbdbd;
-webkit-border-radius: 5px;
border-radius: 5px;
-moz-box-shadow: 0 0 10px #bdbdbd;
-webkit-box-shadow: 0 0 10px #bdbdbd;
box-shadow: 0 0 10px #bdbdbd;
}
HTML
<div id="serviceBox">
<div class="serviceBox1">
<div class="box">
<h2> Heading 1</h2>
<p>Information</p>
</div>
</div>
<div class="serviceBox2">
<div class="box">
<h2>Heading 2</h2>
<p> Information</p>
</div>
</div>
<div class="serviceBox3">
<div class="box">
<h2>Heading 3</h2>
<p>Information</p>
</div>
</div>
<div class="serviceBox4">
<div class="box">
<h2>Heading 4</h2>
<p>Information</p>
</div>
</div>
</div>
This way the service boxes are nicely a quarter of the container and inside service box you can add the border and shading to the new box element
UPDATE: because of the borders , either apply box-sizing:border-box to your style, or put your div with borders inside one more div.
There are at least 4 different ways of doing it.
using float layout
using display:table-cell
using display:inline-block
using absolute positioning
.serviceBox {
box-sizing:border-box;
margin-right:4%;
float:left;
width:20%;
height: 250px;
background-color: white;
border: 1px solid #bdbdbd;
-webkit-border-radius: 5px;
border-radius: 5px;
-moz-box-shadow: 0 0 10px #bdbdbd;
-webkit-box-shadow: 0 0 10px #bdbdbd;
box-shadow: 0 0 10px #bdbdbd;
}
.serviceBox:first { margin-left:4%; }
see updated fiddle
Your problem is that the boxes have a border, so giving them width and margin in percentages that sum to 100% don't work: each box has an extra 2 pixels from the border, pushing the last one off the row. But you can solve this problem by giving them negative margins to compensate for the border:
width:25%;
margins:0 -1px;
try this,
.serviceBox {
margin-left:4%;
float:left;
width:20%;
height: 250px;
background-color: white;
border: 1px solid #bdbdbd;
-webkit-border-radius: 5px;
border-radius: 5px;
-moz-box-shadow: 0 0 10px #bdbdbd;
-webkit-box-shadow: 0 0 10px #bdbdbd;
box-shadow: 0 0 10px #bdbdbd;
}