I'm having trouble getting a table inside a div to always be 100% of the inside of the div, and it appears that the inside table is always a different size inside the div. Perhaps I've muddied the waters on using a table inside, but I do have a bunch of formatting to try display properly. Hoping it does same in either browser etc.
Any help is appreciated.
Most code below.
Overflow Here - when using width=100% inside table
<script language="javascript">
function one_edit() {
var ele = document.getElementById("one_edit");
var text = document.getElementById("one_displayedit");
if(ele.style.display == "block") {
ele.style.display = "none";
text.innerHTML = "<b>ONE</b>";
}
else {
ele.style.display = "block";
text.innerHTML = "<b>ONE</b>";
}
}
</script>
<script language="javascript">
function two_edit() {
var ele = document.getElementById("two_edit");
var text = document.getElementById("two_displayedit");
if(ele.style.display == "block") {
ele.style.display = "none";
text.innerHTML = "<b>TWO</b>";
}
else {
ele.style.display = "block";
text.innerHTML = "<b>TWO</b>";
}
}
</script>
<style type="text/css">
.flist {
font-family: Verdana; font-size: 13pt; font-weight: bold;
overflow: hidden;
position: relative;
background-color: #e9e9e9;
padding: 5px;
margin-top: 5px;
margin-left: 21%;
margin-right: 21%;
border: 1px solid #000;
}
.flist > table
{
width: 100%;
}
.fqlist {
font-family: Verdana; font-size: 12pt; font-weight: normal;
position: relative;
background-color: #f8f8f8;
padding: 5px;
margin-bottom: 5px;
margin-left: 21%;
margin-right: 21%;
border-left: 1px solid #000;
border-right: 1px solid #000;
border-bottom: 1px solid #000;
}
.code10 { font-family: Verdana; font-size: 10pt; font-weight: normal; color: #cc0033;}
.instable {
margin-bottom: 8px;
border: 1px solid #474747;
background-color: #eeeeee;
}
</style>
<div class=flist>
<table cellpadding=2 border=0 style="table-layout:fixed">
<tr>
<td valign=middle>
<a id="one_displayedit" href="javascript:one_edit();"><b>ONE</b></a>
</td>
<td align=right><input type="button" name="CheckAll" value="All N/A" class=verd8 onClick="checkAll(one_)"></td>
</tr>
</table>
</div>
<div id="one_edit" style="display: none" class=fqlist>
<table cellpadding=3 cellspacing=3 align=center class=instable>
<tr>
<td align=center><input type="button" name="CheckAll" value="All Yes" class=verd8 onClick="checkAll(one_yes)"></td>
<td align=center><input type="button" name="CheckAll" value="All No" class=verd8 onClick="checkAll(one_no)"></td>
<td align=center><input type="button" name="CheckAll" value="All N/A" class=verd8 onClick="checkAll(one_)"></td>
</tr>
</table>
<table cellpadding=3 cellspacing=3 align=center class=instable>
<tr>
<td valign=top colspan=3 align=center>
This is a General Question for whatever.
</td>
</tr>
<tr>
<td colspan=3 align=center>
Some General Notes
</td>
</tr>
<tr>
<td align=center class=verd11><b>Yes</b></td>
<td align=center class=verd11><b>No</b></td>
<td align=center class=verd11><b>N/A</b></td>
</tr>
<tr>
<td valign=top colspan=3 align=center>
<span class=code10>General Notes About Question Rules.</span>
</td>
</tr>
<tr>
<td colspan=3 align=center class=cnote width=100%>
<b>Compliance Note:
<br>
<textarea style="width:85%" rows="3" name="compliancenote_#qid#"></textarea>
<br>
</td>
</tr>
</table>
</div>
<div class=flist>
<table cellpadding=2 border=0 style="table-layout:fixed">
<tr>
<td valign=middle>
<a id="two_displayedit" href="javascript:two_edit();"><b>Two</b></a>
</td>
<td align=right><input type="button" name="CheckAll" value="All N/A" class=verd8 onClick="checkAll(two_)"></td>
</tr>
</table>
</div>
<div id="two_edit" style="display: none" class=fqlist>
<table cellpadding=3 cellspacing=3 align=center class=instable>
<tr>
<td align=center><input type="button" name="CheckAll" value="All Yes" class=verd8 onClick="checkAll(two_yes)"></td>
<td align=center><input type="button" name="CheckAll" value="All No" class=verd8 onClick="checkAll(two_no)"></td>
<td align=center><input type="button" name="CheckAll" value="All N/A" class=verd8 onClick="checkAll(two_)"></td>
</tr>
</table>
<table cellpadding=3 cellspacing=3 align=center class=instable>
<tr>
<td valign=top colspan=3 align=center>
This is a General Question for whatever and is bigger than the other question, and I am trying to keep going to make it bigger and longer.
So not sure how to get these showing as same width across entire div length.
</td>
</tr>
<tr>
<td colspan=3 align=center>
Some General Notes
</td>
</tr>
<tr>
<td align=center class=verd11><b>Yes</b></td>
<td align=center class=verd11><b>No</b></td>
<td align=center class=verd11><b>N/A</b></td>
</tr>
<tr>
<td valign=top colspan=3 align=center>
<span class=code10>General Notes About Question Rules.</span>
</td>
</tr>
<tr>
<td colspan=3 align=center class=cnote width=100%>
<b>Compliance Note:
<br>
<textarea style="width:85%" rows="3" name="compliancenote_#qid#"></textarea>
<br>
</td>
</tr>
</table>
</div>
It doesn't seem like you're applying width:100%; to the overflowing table. Try doing that (I believe the overflowing table is .instable):
.instable {
width:100%;
}
Also try viewing it in different browsers to see whether it works. I'm using Chrome and the table doesn't even fill the entire div.
Related
"I am working on creating an HTML template for an invoice and am having some difficulty placing the QR code image in the correct location. Specifically, I want the QR code image to appear directly under the invoice information table, but it is not appearing in the desired location.
table {
border-collapse: collapse;
font-family: Arial, sans-serif;
margin: 10px auto;
font-size: 14px;
color: #1e2b40;
}
td,
th {
border: 1px solid gray;
padding: 6px;
}
.center {
text-align: center;
}
.right {
text-align: right;
}
.bold {
font-weight: bold;
}
.contact-info {
font-family: Arial, sans-serif;
font-size: 12px;
float: right;
margin: 1px auto;
font-weight: normal;
}
.contact-info ul {
list-style-type: none;
}
.qr-code {
clear: both;
display: block;
width: 300px;
height: 300px;
margin: 0 auto;
}
.srs.logo {
width: 300px;
height: 150px;
margin: 10px auto;
}
.items-table {
float: left;
padding: 6px;
margin: 10px auto;
border-collapse: collapse;
width: 100%;
}
.items-table th,
.items-table td {
border: 1px solid gray;
padding: 6px;
<header>
<!-- header content goes here -->
<img src="https://drive.google.com/file/d/1mwNaPe8w4Bxn7mkXivmI2dqcwBg4_aog" alt="srs-logo" />
<div class="contact-info" style="list-style-type: none">
<ul>
<li>SARL RO SOLUTION</li>
<li>RC: RC:</li>
<li>NIF: NIF</li>
<li>AI: AI</li>
<li>Phone: Phone:</li>
<li>Email: info#company.com</li>
</ul>
</div>
</header>
<hr style="margin-top: 100px;">
<!-- rest of the page content goes here -->
<table style="float: left;">
<tr>
<td colspan="2" class="center bold">Customer Information</td>
<tr>
<tr>
<td>Customer Name:</td>
<td><<[Customer Name]>></td>
</tr>
<tr>
<td>Customer Address:</td>
<td><<[Customer Address]>></td>
</tr>
<tr>
<td>Customer NIF:</td>
<td><<[Customer NIF]>></td>
</tr>
<tr>
<td>Customer RC:</td>
<td><<[Customer RC]>></td>
</tr>
<tr>
<td>Customer AI:</td>
<td><<[Customer AI]>></td>
<tr>
<td>Telephone:</td>
<td><<[Company AI]>></td>
</tr>
</table>
<table style="float: right; margin: 0 auto">
<tr>
<td colspan="2" class="center bold">Invoice Information</td>
<tr>
<td>Invoice Date:</td>
<td><<[Invoice Date]>></td>
<tr>
<td>Invoice ID:</td>
<td><<[Invoice ID]>></td>
</tr>
</table>
<br style="clear: both;">
<img src="<<[Invoice Date]>>" alt="qr-code">
<br style="clear: both;">
<hr>
<table style="float: left;">
<tr>
<td rowspan="1" class="center bold">Related Sales</td>
<td colspan="" class="center bold">Invoice Information</td>
</table>
<br style="clear: both;">
<hr>
<table class="items-table">
<thead>
<tr>
<th>Item description</th>
<th>Quantity</th>
<th>Unit Price</th>
<th>Total</th>
</tr>
</thead>
<tbody>
<p class="startifend"><<Start:[invoice_key].[Related invoice_items]>></p>
<tr>
<td><<[description]>></td>
<td><<[quantity]>></td>
<td><<[unit_price]>></td>
<td><<[total_price]>></td>
</tr>
<p class="startifend"><<End>></p>
</tbody>
</table>
<br style="clear: both;">
<hr>
I'm going to presume you have a good reason for using tables over grid/flexbox.
A couple of issues to note. Firstly, be very care to always close your <tr> tags there were many unclosed tags through the code which I've corrected in the below snippet.
Secondly, the behaviour of the QR img tag was completely correct in your example and it was rendering where it should have been. In order to achieve the desired outcome, you want to put your Customer Information and Invoice Information tables inside a parent table.
In short:
<table>
<tr>
<td> <!-- Customer Information Table --> </td>
<td> <!-- Invoice Information Table --> </td>
</tr>
</table>
This will allow you to but the QR img directly underneath the Invoice Information Table inside the same <td> tag.
table {
border-collapse: collapse;
font-family: Arial, sans-serif;
margin: 10px auto;
font-size: 14px;
color: #1e2b40;
}
td,
th {
border: 1px solid gray;
padding: 6px;
}
.center {
text-align: center;
}
.right {
text-align: right;
}
.bold {
font-weight: bold;
}
.contact-info {
font-family: Arial, sans-serif;
font-size: 12px;
float: right;
margin: 1px auto;
font-weight: normal;
}
.contact-info ul {
list-style-type: none;
}
.qr-code {
clear: both;
display: block;
width: 300px;
height: 300px;
margin: 0 auto;
}
.srs.logo {
width: 300px;
height: 150px;
margin: 10px auto;
}
.items-table {
float: left;
padding: 6px;
margin: 10px auto;
border-collapse: collapse;
width: 100%;
}
.items-table th,
.items-table td {
border: 1px solid gray;
padding: 6px;
<header>
<!-- header content goes here -->
<img src="https://drive.google.com/file/d/1mwNaPe8w4Bxn7mkXivmI2dqcwBg4_aog" alt="srs-logo" />
<div class="contact-info" style="list-style-type: none">
<ul>
<li>SARL RO SOLUTION</li>
<li>RC: RC:</li>
<li>NIF: NIF</li>
<li>AI: AI</li>
<li>Phone: Phone:</li>
<li>Email: info#company.com</li>
</ul>
</div>
</header>
<hr style="margin-top: 100px;">
<!-- rest of the page content goes here -->
<table style="border:0; width:100%;">
<tr>
<td style="border:0; vertical-align:top">
<table style="float:left;margin:0">
<tr>
<td colspan="2" class="center bold">Customer Information</td>
</tr>
<tr>
<td>Customer Name:</td>
<td><<[Customer Name]>></td>
</tr>
<tr>
<td>Customer Address:</td>
<td><<[Customer Address]>></td>
</tr>
<tr>
<td>Customer NIF:</td>
<td><<[Customer NIF]>></td>
</tr>
<tr>
<td>Customer RC:</td>
<td><<[Customer RC]>></td>
</tr>
<tr>
<td>Customer AI:</td>
<td><<[Customer AI]>></td>
</tr>
<tr>
<td>Telephone:</td>
<td><<[Company AI]>></td>
</tr>
</table>
</td>
<td style="border:0; vertical-align:top;text-align:right;">
<table style="float:right;">
<tr>
<td colspan="2" class="center bold">Invoice Information</td>
</tr>
<tr>
<td>Invoice Date:</td>
<td><<[Invoice Date]>></td>
</tr>
<tr>
<td>Invoice ID:</td>
<td><<[Invoice ID]>></td>
</tr>
</table>
<br style="clear:both;">
<img src="<<[Invoice Date]>>" alt="qr-code">
</td>
</tr>
</table>
<br style="clear: both;">
<hr>
<table style="float: left;">
<tr>
<td rowspan="1" class="center bold">Related Sales</td>
<td colspan="" class="center bold">Invoice Information</td>
</tr>
</table>
<br style="clear: both;">
<hr>
<table class="items-table">
<thead>
<tr>
<th>Item description</th>
<th>Quantity</th>
<th>Unit Price</th>
<th>Total</th>
</tr>
</thead>
<tbody>
<p class="startifend"><<Start:[invoice_key].[Related invoice_items]>></p>
<tr>
<td><<[description]>></td>
<td><<[quantity]>></td>
<td><<[unit_price]>></td>
<td><<[total_price]>></td>
</tr>
<p class="startifend"><<End>></p>
</tbody>
</table>
<br style="clear: both;">
<hr>
This should do the trick, added a container to the tables and applied flex box. Remove the margin from the table selector, if you want the tables to go to the left and right edges.
<div style="display:flex;justify-content:space-between;">
<table>
<tr>
<td colspan="2" class="center bold">Customer Information</td>
<tr>
<tr>
<td>Customer Name:</td>
<td><<[Customer Name]>></td>
</tr>
<tr>
<td>Customer Address:</td>
<td><<[Customer Address]>></td>
</tr>
<tr>
<td>Customer NIF:</td>
<td><<[Customer NIF]>></td>
</tr>
<tr>
<td>Customer RC:</td>
<td><<[Customer RC]>></td>
</tr>
<tr>
<td>Customer AI:</td>
<td><<[Customer AI]>></td>
<tr>
<td>Telephone:</td>
<td><<[Company AI]>></td>
</tr>
</table>
<table>
<tr>
<td colspan="2" class="center bold">Invoice Information</td>
<tr>
<td>Invoice Date:</td>
<td><<[Invoice Date]>></td>
<tr>
<td>Invoice ID:</td>
<td><<[Invoice ID]>></td>
</tr>
</table>
</div>
<img style="float:right;" src="<<[Invoice Date]>>" alt="qr-code">
In a table that I've made with HTML and CSS, the first column is of a different height than the rest?
The top of the column is uneven with the others to the right of it.
Do run the code snippet below. The column I'm referring to is the "Date joined / Name / Email" block.
How can I fix this?
My current code looks like this:
<style>.table1 {
border-spacing: 1px;
}
.container {
border: 1px solid black;
margin: 10px;
padding: 10px;
align-content: center;
margin-left: auto;
margin-right: auto;
font-family: Calibri, sans-serif;
font-size: 15px;
}
</style>
<body>
<div class="container">
<h2 style="margin: 11px; height: 37px;"><u>Table Test:</u></h2>
<table class="table1" border="1" style="width:50%">
<tr style="background-color:#D6EAF8">
<td colspan="3" align="center" width="60%" style="height:30px"><b>Main</b></td>
<td colspan="1" align="center" width="10%"><b>Email</b></td>
</tr>
<tr>
<td rowspan="4" align="center">Date joined /<br> Name / Email</td>
</tr>
<tr>
<td align="center">05022022</td>
<td style="height:30px" align="center">Kimberly</td>
<td align="center">kimberlyk#gmail.com</td>
</tr>
<tr>
<td align="center">02152022</td>
<td style="height:30px" align="center">Robert</td>
<td align="center">robwayne#gmail.com</td>
</tr>
<tr>
<td align="center">12232021</td>
<td style="height:30px" align="center">Jessie</td>
<td align="center">jessieanderson#gmail.com</td>
</tr>
</table>
</div>
</body>
So you just had a little obfuscation in your colspans/rowspan attributes. Fixing the way you asked wouldn't align your column headers though and have just "Date Joined / Name / Email" centered on their own row though that wasn't very intuitive so I'm assuming you were maybe aiming for something closer to the example provided below. Cheers.
<style>.table1 {
border-spacing: 1px;
}
.container {
border: 1px solid black;
margin: 10px;
padding: 10px;
align-content: center;
margin-left: auto;
margin-right: auto;
font-family: Calibri, sans-serif;
font-size: 15px;
}
</style>
<body>
<div class="container">
<h2 style="margin: 11px; height: 37px;"><u>Table Test:</u></h2>
<table class="table1" border="1" style="width:50%">
<tr style="background-color:#D6EAF8">
<th colspan="2" align="center" width="60%" style="height:30px"><b>Main</b></th>
<th colspan="1" rowspan="2" align="center" width="10%"><b>Email</b></th>
</tr>
<tr>
<td align="center">Date joined</td>
<td align="center">Name</td>
</tr>
<tr>
<td align="center">05022022</td>
<td style="height:30px" align="center">Kimberly</td>
<td align="center">kimberlyk#gmail.com</td>
</tr>
<tr>
<td align="center">02152022</td>
<td style="height:30px" align="center">Robert</td>
<td align="center">robwayne#gmail.com</td>
</tr>
<tr>
<td align="center">12232021</td>
<td style="height:30px" align="center">Jessie</td>
<td align="center">jessieanderson#gmail.com</td>
</tr>
</table>
</div>
</body>
So I have the following table that I have created using HTML and CSS: However, I would like the three pieces of information under Harvesting to be split divided evenly so that each cell takes the same amount of space in the Harvesting column. Right now, the table cell with electroflocculation takes up the space of 2 cells because I assigned it to temporarly do so using the rowspan attribute when it should ideally be taking up the space of 4/3 of a cell,
<html>
<head>
<style>
body {
font-family: Arial, Verdana, sans-serif;
font-size: 12 px;
color: #111111;}
th {
letter-spacing: 0.1em;
border-bottom: 2px solid #111111;
border-top: 1px solid #999;
}
.ExtractionConversion {
background-color: #f4cccc;
}
.Cultivation {
background-color: #d9ead3;
}
.Harvesting {
background-color: #fce5cd;
}
.Dewatering {
background-color: #c9daf8;
}
.Extraction {
background-color: #d9d2e9;
}
.Conversion {
background-color: #fff2cc;
}
</style>
</head>
<body>
<table width=800 height=100 style="text-align: center" padding="10">
<thead>
<th>Cultivation</th>
<th>Harvesting</th>
<th>Dewatering</th>
<th>Extraction</th>
<th>Conversion</th>
</thead>
<tbody>
<tr>
<td rowspan="4" class="Cultivation";>Photobioreactor</td>
<td class="Harvesting">Centrifugation</td>
<td rowspan="2" class="Dewatering">Heat Drying</td>
<td rowspan="2" class="Extraction">Wet Solvent Extraction</td>
<td class="Conversion">Decarboxylation<td>
</tr>
<tr>
<td class="Harvesting">Electrocoagulation</td>
<td class="Conversion">Transesterfication</td>
</tr>
<tr>
<td rowspan="2" class="Harvesting">Electroflocculation</td>
<td rowspan="2" class="Dewatering">Speed Drying</td>
<td colspan="2" class="ExtractionConversion">HTL-CHG</td>
</tr>
<tr>
<td colspan="2" class="ExtractionConversion">Pyrolysis</td>
</tr>
</tbody>
</table>
<body>
</html>
You can insert another table in that and style the cells, adding borders to get it done. It's not pretty but it works.
<html>
<head>
<style>
body {
font-family: Arial, Verdana, sans-serif;
font-size: 12 px;
color: #111111;}
th {
letter-spacing: 0.1em;
border-bottom: 2px solid #111111;
border-top: 1px solid #999;
}
.ExtractionConversion {
background-color: #f4cccc;
}
.Cultivation {
background-color: #d9ead3;
}
.Harvesting {
background-color: #fce5cd;
}
.Dewatering {
background-color: #c9daf8;
}
.Extraction {
background-color: #d9d2e9;
}
.Conversion {
background-color: #fff2cc;
}
</style>
</head>
<body>
<table width=800 height=100 style="text-align: center" padding="10">
<thead>
<th>Cultivation</th>
<th>Harvesting</th>
<th>Dewatering</th>
<th>Extraction</th>
<th>Conversion</th>
</thead>
<tbody>
<tr>
<td rowspan="4" class="Cultivation";>Photobioreactor</td>
<td class="Harvesting">Centrifugation</td>
<td rowspan="2" class="Dewatering">Heat Drying</td>
<td rowspan="2" class="Extraction">Wet Solvent Extraction</td>
<td class="Conversion">Decarboxylation<td>
</tr>
<tr>
<td class="Harvesting">Electrocoagulation</td>
<td class="Conversion">Transesterfication</td>
</tr>
<tr>
<td rowspan="2" class="Harvesting">Electroflocculation</td>
<td rowspan="2" class="Dewatering">Speed Drying</td>
<td colspan="2" class="ExtractionConversion">HTL-CHG</td>
</tr>
<tr>
<td colspan="2" class="ExtractionConversion">Pyrolysis</td>
</tr>
</tbody>
</table>
<br>
<table width=800 height=100 style="text-align: center" padding="10">
<thead>
<th>Cultivation</th>
<th>Harvesting</th>
<th>Dewatering</th>
<th>Extraction</th>
<th>Conversion</th>
</thead>
<tbody>
<tr>
<td rowspan="4" class="Cultivation";>Photobioreactor</td>
<td rowspan="4" class="Harvesting" style="padding:0;">
<table cellpadding=0 cellspacing=0 width=100% height=100% style="text-align: center">
<tr>
<td class="Harvesting" style="border-bottom:2px solid white;">Centrifugation</td>
</tr>
<tr>
<td class="Harvesting" style="border-bottom:2px solid white;">Electrocoagulation</td>
</tr>
<tr>
<td class="Harvesting">Electroflocculation</td>
</tr>
</table>
</td>
<td rowspan="2" class="Dewatering">Heat Drying</td>
<td rowspan="2" class="Extraction">Wet Solvent Extraction</td>
<td class="Conversion">Decarboxylation<td>
</tr>
<tr>
<td class="Conversion">Transesterfication</td>
</tr>
<tr>
<td rowspan="2" class="Dewatering">Speed Drying</td>
<td colspan="2" class="ExtractionConversion">HTL-CHG</td>
</tr>
<tr>
<td colspan="2" class="ExtractionConversion">Pyrolysis</td>
</tr>
</tbody>
</table>
<br>
<body>
</html>
I'm trying to convert from table to bootstrap grid for mobile comparability. Below is an image of both of them on one page but even though they both follow the same css, bootstrap isn't at the center unlike table is. Can someone please explain this to me because this makes no sense.
Thank you
table is at the top and Bootstrap is at the bottom
and here's my HTML
.platinum2 {
color: #FFFFFF;
font-size: 30px;
font-weight: 600;
line-height: 41px;
text-align: center;
}
.package_text {
color: #FFFFFF;
font-family: "lato";
font-size: 14px;
font-weight: 500;
line-height: 26px;
}
.package_price {
color: #FFFFFF;
font-family: "lato";
font-size: 16px;
font-weight: bold;
line-height: 14px;
text-align: center;
}
.glyphicon-star{
font-size: 20px;
}
<div class="row" style="width:50%;margin-left:25% ; margin-bottom:25px; text-align:center">
<h1 class="platinum2">Platinum <br><span class="glyphicon glyphicon-star" style="color:#FFFACC" /><span class="glyphicon glyphicon-star" style="color:#FFFACC" /><span class="glyphicon glyphicon-star" style="color:#FFFACC" /> </h1>
<div class="col-md-6" >
<span class="package_text">Hand Wash<br>Full Interior<br>Complete Vacuum<br>Leather Clean+Shine<br>
<br />
Tire Dressing<br>Tire and Rim Detailing<br>Engine Shampoo<br />
<br /></span>
<span class="package_price"> Cars: $189</span>
</div>
<div class="col-md-6">
<span class="package_text">Roof Liner<br>Full Body Wax<br>Clay Bar Treatment<br>Interior Shampooing<br />
<br />
Complete Detail<br>In & Out Windows<br>Door Jam Cleaning<br />
<br /></span>
<span class="package_price">SUVs: $199</span>
</div>
</div>
</div>
<div class="container" style="background-image:url('/images/StripedBGDetailPackages.png' ); align-items:center; text-align:center; margin-top:25px; padding-top:25px; background-size:100%" >
<table style="width:50%;margin-left:25% ; margin-right:25%; margin-bottom:25px;">
<tr>
<td class="platinum2">Gold</td>
<td class="platinum2">Silver</td>
</tr>
<tr>
<td><span class="glyphicon glyphicon-star" style="color:#FFFACC" /><span class="glyphicon glyphicon-star" style="color:#FFFACC" /></td>
<td><span class="glyphicon glyphicon-star" style="color:#FFFACC" /></td>
</tr>
<tr>
<td class="package_text">Hand Wash</td>
<td class="package_text">Hand Wash</td>
</tr>
<tr>
<td class="package_text">Complete Vacuum</td>
<td class="package_text">Clay Bar Treatment</td>
</tr>
<tr>
<td class="package_text">Interior Shampooing</td>
<td class="package_text">Complete Body Wax</td>
</tr>
<tr>
<td class="package_text">Leather Clean+Shine</td>
<td class="package_text">Tire and Rim</td>
</tr>
<tr>
<td class="package_text">Complete Deetail</td>
<td class="package_text">Detailing</td>
</tr>
<tr>
<td class="package_text">In & Out Windows</td>
<td class="package_text">Tire Dressing</td>
</tr>
<tr class="package_text">
<td> </td>
<td> </td>
</tr>
<tr>
<td class="package_price">Cars:$119 SUVs:$129</td>
<td class="package_price">Cars:$99 SUVs:$109</td>
</tr>
</table>
<div class="row" style="width:50%;margin-left:25% ; margin-right:25%; margin-bottom:25px;">
<div class="col-md-6">
<table>
<tr>
<td class="platinum2">Gold</td>
</tr>
<tr>
<td><span class="glyphicon glyphicon-star" style="color:#FFFACC" /><span class="glyphicon glyphicon-star" style="color:#FFFACC" /></td>
</tr>
<tr>
<td class="package_text">Hand Wash</td>
</tr>
<tr>
<td class="package_text">Complete Vacuum</td>
</tr>
<tr>
<td class="package_text">Interior Shampooing</td>
</tr>
<tr>
<td class="package_text">Leather Clean+Shine</td>
</tr>
<tr>
<td class="package_text">Complete Deetail</td>
</tr>
<tr>
<td class="package_text">In & Out Windows</td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td class="package_price">Cars:$119 SUVs:$129</td>
</tr>
</table>
</div>
<div class="col-md-6">
<table>
<tr>
<td class="platinum2">Silver</td>
</tr>
<tr>
<td><span class="glyphicon glyphicon-star" style="color:#FFFACC" /></td>
</tr>
<tr>
<td class="package_text">Hand Wash</td>
</tr>
<tr>
<td class="package_text">Clay Bar Treatment</td>
</tr>
<tr>
<td class="package_text">Complete Body Wax</td>
</tr>
<tr><td class="package_text">Tire and Rim</td></tr>
<tr><td class="package_text">Detailing</td></tr>
<tr><td class="package_text">Tire Dressing</td></tr>
<tr><td> </td></tr>
<tr><td class="package_price">Cars:$99 SUVs:$109</td></tr>
</table>
</div>
</div>
To debug, first I added the following since your text are white, and border to everything with 1px solid red color, by doing this it is very easy to see why it is not centered! check the link
body {
background-color: gray;
}
* {
border: 1px solid red;
}
https://jsfiddle.net/dalinhuang/aLpv8k3f/4/
Now, as you can see Gold BS it is in the correct position, that's because
you need only add the following class to your <table class="fullwidth">
.fullwidth {
width: 100%;
}
OK, full solution, remove the debug stuff we added:
https://jsfiddle.net/dalinhuang/aLpv8k3f/5/
Also I think your star are not in the same line, update your .glyphicon-star to add this margin-top: -1px;.
.glyphicon-star {
font-size: 20px;
margin-top: -1px;
}
I'm trying to make some kind of "menu", but my menu items have too large heights in IE. Tested it on chrome, firefox and safari and it's working fine. What's wrong with my code? Please help. I just want them to be "fixed" 2em in height, is it possible in ie? And I wonder, is it an error in my page or just an IE bug?
window.onload=init;
window.onpageshow=init;
function init()
{
var main=document.getElementById("mainview");
var str=String.fromCharCode(Math.round( Math.random()*(90-65))+65);
var chr;
for(var i=0;i<20000;i++)
{
chr=String.fromCharCode(Math.round(Math.random()*(122-97))+97);
if(chr!="<") str=str+chr;
if(Math.random()<0.02)
{ chr=". "+String.fromCharCode(Math.round(Math.random()*(90-65))+65);
}
if(Math.random()<0.2)
{ str+=" ";
}
str+=chr;
}
main.innerHTML=str;
}
table
{ width: 100%;
border-collapse: collapse;
border-spacing: 0px;
padding: 0;
background-color: #fff;
table-layout: fixed;
}
tr.first
{
background-color: #000;
height: 2em;
}
tr.space
{
height: 1em;
}
td.lmargin
{
width: 3em;
}
td.label
{
width: 10em;
height: 4em;
background-color: #c30425;
}
td.menu
{
padding-left: 2em;
vertical-align: middle;
height: 2em;
border-top: 1px solid #000;
border-bottom: 1px solid #000;
}
td.dummy
{
height: auto;
}
td#mainview
{
padding-left: 2em;
}
<table>
<tr class="first">
<td class="lmargin">
</td>
<td rowspan="2" class="label">
</td>
<td>
</td>
</tr>
<tr>
<td class="lmargin">
</td>
<td>
</td>
</tr>
<tr class="space">
<td class="lmargin">
</td>
<td>
</td>
<td>
</td>
</tr>
<tr>
<td class="lmargin">
</td>
<td class="menu">
Menu item 1
</td>
<td rowspan="6" id="mainview">
</td>
</tr>
<tr>
<td class="lmargin">
</td>
<td class="menu">
Menu item 2
</td>
</tr>
<tr>
<td class="lmargin">
</td>
<td class="menu">
Menu item 3
</td>
</tr>
<tr>
<td class="lmargin">
</td>
<td class="menu">
Menu item 4
</td>
</tr>
<tr>
<td class="lmargin">
</td>
<td class="menu">
Menu item 5
</td>
</tr>
<tr>
<td class="lmargin">
</td>
<td class="dummy">
</td>
</tr>
</table>
Update: found the reason
https://support.microsoft.com/en-us/kb/2312750
The ROWSPAN property is disabled in Internet Explorer 8 if a webpage contains a tag in a table cell
It seems IE does not allow right cell to be larger than the left cell. Open developer console on IE (press F12) change
<td id="mainview" rowspan="6">
to
<td id="mainview" rowspan="1">
and see the differences.