I found the following css on the net and used it on my site to show a side by side tables. Most of them are working nicely in all three browsers, IE11, Chrome and Firefox except on one of my template. Although the tables show side by side but the content of the right table does not fully fill the cell correctly. Instead, it seems like the css creates two columns on the right table and only fill in the content of the left column leaving the right column blank. The right table only have one cell.
Here is the codes creating side by side tables:
.zui-table {
border: solid 1px #DDEEEE;
border-collapse: collapse;
border-spacing: 0;
font: normal 12px Arial, sans-serif;
}
.zui-table thead th {
background-color: ##DDEFEF;
;
border: solid 1px #DDEEEE;
;
color: #336B6B;
padding: 3px;
text-align: left;
text-shadow: 1px 1px 1px #fff;
}
.zui-table tbody td {
border: solid 1px #DDEEEE;
;
color: #333;
padding: 3px;
text-shadow: 1px 1px 1px #fff;
}
.zui-table-horizontal tbody td {
border-left: none;
border-right: none;
}
<div id="wrap">
<table CLASS="zui-table">
<tbody>
<tr>
<td valign="top">
<div class="medGreyText">Requester</div>
</td>
<td valign="top"><input type="text" name="requester" class="inputReqText" value="somevalue" Required="True"></td>
</tr>
<tr>
<td valign="top">
<div class="medGreyText">Requesting Institution</div>
</td>
<td valign="top">
<select Name="req_institution" id="req_institution" class="RegSelect" Required="True">
<option value="">--- Please select Institution ---</option>
<option value="xx">xx</option>
<option value="aa">aa</option>
<option value="bb">bb</option>
<option value="cc">cc</option>
</select>
</td>
</tr>
<tr>
<td valign="top">
<div class="medGreyText">Requester's Email</div>
</td>
<td valign="top"><input name="req_email" id="req_email" type="text" class="inputReqText" value="" Required="True"></td>
</tr>
<tr>
<td valign="top">
<div class="medGreyText">Entity Type</div>
</td>
<td valign="top">
<select Name="type" class="RegSelect" Required="True">
<option value="">---Please select entity type ---</option>
<option value="Ind">Individual</option>
<option value="Org">Organization</option>
</select>
</td>
</tr>
<tr>
<td valign="top">
<div class="medGreyText">Advance ID</div>
</td>
<td valign="top"><input type="text" name="idno" id="idno" class="inputReqText" value="" Required="True"></td>
</tr>
<tr>
<td align="center" colspan="2">
<br><br>
<input name="submit" type="submit" value="G E T D A T A" class="SubmitButtons">
</td>
</tr>
</tbody>
</table>
<table CLASS="zui-table">
← the problem area!!! <tbody>
<tr>
<td>
<b>OFFICE POLICY</b><br> It is the goal of the XX research office to offer its' constituents quality.....forth and clarifying our procedures and explaining some of our methods etc....
</td>
</tr>
</tbody>
</table>
</div>
As you see from the screenshot, the tables appear side by side but the content of the right table, the office policy, is not populating the whole cell but instead this css on this template creates two columns side by side. I've been debugging this since this morning with no success.
the css zui-table-horizontal tbody td does not seem to work???
There are several ways to accomplish 2 side-by-side tables with HTML/CSS. There is already an SO answer here:
HTML — Two Tables Horizontally Side by Side
Their example of using one of these styles will solve most cases:
display: inline-block
or
float: left
There are a few things to consider though. In responsive HTML on a mobile device, the tables as you have it will probably go one above the other, which is a good thing for the user experience. If you force them to be side-by-side, the user many never see the right side table.
If side-by-side tables is what you really want, you could go old school and embed your tables in another table, and put each table in separate table columns.
For example, the following snippet generates what you want:
.zui-table {
border: solid 1px #DDEEEE;
border-collapse: collapse;
border-spacing: 0;
font: normal 12px Arial, sans-serif;
}
.zui-table thead th {
background-color: #DDEFEF;
border: solid 1px #DDEEEE;
color: #336B6B;
padding: 3px;
text-align: left;
text-shadow: 1px 1px 1px #fff;
}
.zui-table tbody td {
border: solid 1px #DDEEEE;
color: #333;
padding: 3px;
text-shadow: 1px 1px 1px #fff;
}
.zui-table-horizontal tbody td {
border-left: none;
border-right: none;
}
<div id="wrap">
<table>
<tr>
<td>
<table CLASS="zui-table">
<tbody>
<tr>
<td valign="top">
<div class="medGreyText">Requester</div>
</td>
<td valign="top"><input type="text" name="requester" class="inputReqText" value="somevalue" Required="True"></td>
</tr>
<tr>
<td valign="top">
<div class="medGreyText">Requesting Institution</div>
</td>
<td valign="top">
<select Name="req_institution" id="req_institution" class="RegSelect" Required="True">
<option value="">--- Please select Institution ---</option>
<option value="xx">xx</option>
<option value="aa">aa</option>
<option value="bb">bb</option>
<option value="cc">cc</option>
</select>
</td>
</tr>
<tr>
<td valign="top">
<div class="medGreyText">Requester's Email</div>
</td>
<td valign="top"><input name="req_email" id="req_email" type="text" class="inputReqText" value="" Required="True"></td>
</tr>
<tr>
<td valign="top">
<div class="medGreyText">Entity Type</div>
</td>
<td valign="top">
<select Name="type" class="RegSelect" Required="True">
<option value="">---Please select entity type ---</option>
<option value="Ind">Individual</option>
<option value="Org">Organization</option>
</select>
</td>
</tr>
<tr>
<td valign="top">
<div class="medGreyText">Advance ID</div>
</td>
<td valign="top"><input type="text" name="idno" id="idno" class="inputReqText" value="" Required="True"></td>
</tr>
<tr>
<td align="center" colspan="2">
<br><br>
<input name="submit" type="submit" value="G E T D A T A" class="SubmitButtons">
</td>
</tr>
</tbody>
</table>
</td>
<td>
<table CLASS="zui-table">
<tbody>
<tr>
<td>
<b>OFFICE POLICY</b><br> It is the goal of the XX research office to offer its' constituents quality.....forth and clarifying our procedures and explaining some of our methods etc....
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</table>
</div>
Related
Here is the problem I got. Please see the attached screen capture.
Wide Column A:
I want the SPRINKLER DUTY REQUIREMENT/S to be 750px same as the ANNUBAR FLOW TEST RESULTS.
And also please check the screenshot. My inches of mercury column is so wide. I will only adding number 0 to 34 for that.
Here is my code:
<!-- Chart Nine Body -->
<div class="row g-0" id="chartNine" style="display:none;">
<h4 class="card-title">TOWN'S MAIN FED - SPRINKLER ANNUBAR FLOW TEST</h4>
<table id="dataTable2">
<thead>
<tr>
<th>SPRINKLER DUTY REQUIREMENT/S</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<label></label>
<input type="text6" value="0" />
<label> L/MIN # </label>
<input type="text6" value="0" />
<label> KPA </label>
</td>
</tr>
</tbody>
</table>
<button onclick="addTable('dataTable2');">+</button>
<br>
<table id="dataTable3">
<!--<table>-->
<thead>
<tr>
<th>ANNUBAR FLOW TEST RESULTS</th>
</tr>
</thead>
<tbody>
<tr>
<td style="background-color: gray">
INCHES OF MERCURY
</td>
<td style="background-color: gray">
MODEL 20T, SINGLE MOUNT 3/8" Dia Probe Size
<select>
<option disabled selected style="font-weight: bold">SELECT AN OPTION</option>
<option>20T DN50</option>
<option>20T DN65</option>
<option>20T DN80</option>
<option>20T DN90</option>
<option>20T DN100</option>
<option>20T DN125</option>
<option>20T DN150</option>
</select>
</td>
<td style="background-color: gray">
kPa
</td>
</tr>
<tr>
<td style="background-color: gray">
<label>
INCHES OF MERCURY
</label>
</td>
<td style="background-color: gray">
<label>MODEL 20T, SINGLE MOUNT 3/8" Dia Probe Size
<select>
<option disabled selected style="font-weight: bold">SELECT AN OPTION</option>
<option>20T DN50</option>
<option>20T DN65</option>
<option>20T DN80</option>
<option>20T DN90</option>
<option>20T DN100</option>
<option>20T DN125</option>
<option>20T DN150</option>
</select></label>
</td>
<td style="background-color: gray">
<label>kPa</label>
</td>
</tr>
<td>
<label for="range1">
0
</label>
</td>
<td>
<label>TEST</label>
</td>
<td>
<input type="text6" value="0" />
</td>
</tbody>
</table>
</div>
<div class="box" style="width: 750px;">
<canvas id="nineChart" style="display:none;"></canvas>
</div>
And here is my function:
#dataTable2 {
counter-reset: nRow;
}
#dataTable2 thead th {
font-size: 1.2em;
padding: .4em 0;
background-color: gray;
min-width: 34rem;
width: 290px;
}
#dataTable3 thead th {
font-size: 1.2em;
padding: .4em 0;
background-color: gray;
min-width: 34rem;
width: 290px;
}
#dataTable3 div:first-child
{
width:30%;
}
/*#dataTable3 tbody tr td label:nth-child(1) {*/
/* display: inline-block;*/
/* width: 2em;*/
/* text-align: center;*/
/*}*/
#dataTable2 tbody tr td label:nth-child(1) {
display: inline-block;
width: 2em;
text-align: center;
}
#dataTable2 tbody tr td label:nth-child(1)::before {
counter-increment: nRow;
content: counter(nRow);
}
I really need your help. It would benefit me, thank you so much!
Did you try to insert a fixed width?
<!-- Chart Nine Body -->
<tr>
<th style="width: 750px;">SPRINKLER DUTY REQUIREMENT/S</th>
</tr>
I need to make a div with a solid border. I have a good start but having some trouble getting the alignment right and getting the lines working. Below is an image of the requested HTML
So far I think I'm some what close with my HTML but my two top lines do not match and I cant get the vertical line in.
code:
<div style="width:60%;border:solid">
<div style="width:45%; display: inline-block;">
<div style="margin-left:5px;">
Domestic Shipping and Handling<br>
<hr style="width: 5px;"/><br>
$25..01 to $50.00..add $7.95 <br>
$50.01 to $75.00...add $11.95 <br>
$75.01 to $100.00...add $13.95 <br>
$100.01 to $150.00...add $17.95 <br>
$150.01 to $200.00 .. add $19.95 <br>
200.01 – above.. add $23.95
</div>
</div>
<div style="width: 8%; display: inline-block;"><hr style="width: 1px; height: 100px;"></div>
<div style="width:45%; display: inline-block;">
Canada, AK, HI, PR Shipping and Handling<br>
<hr style="width: 5px;"/><br>
$.01-$25.00.. add $14.95<br>
$25.01 - $50.00.add $15.95<br>
$50.01 to $75.00...add $18..95<br>
$75.01 to $100.00...add $20.95<br>
$100.01 to $150.00..add $25.95<br>
$150.01 to $200.00..add $28.95<br>
$200.01 to above....add $32.95
</div>
</div>
Here is what my HTML looks like on the web page currently:
I'm currently missing the vertical line, top headers are not aligning and bottom texts are not aligning. Originally this was using a table which is fine but now we want it to be responsive and to use div's. I also can not use css. I would prefer to use css personally but that request was denied.
You should probably build this using html tables. See here for further help.
<style>
table,
th {
border: 1px solid black;
border-collapse: collapse;
}
td {
border-right: 1px solid black;
}
</style>
<table>
<tr>
<th>Domestic Shipping and Handling</th>
<th>Canada, AK, HI, PR Shipping and Handling</th>
</tr>
<tr>
<td> $25..01 to $50.00..add $7.95 </td>
<td> $.01-$25.00.. add $14.95</td>
</tr>
<tr>
<td>$50.01 to $75.00...add $11.95</td>
<td>$25.01 - $50.00.add $15.95</td>
</tr>
<tr>
<td>$75.01 to $100.00...add $13.95</td>
<td>$50.01 to $75.00...add $18..95</td>
</tr>
<tr>
<td>$100.01 to $150.00...add $17.95</td>
<td>$75.01 to $100.00...add $20.95</td>
</tr>
<tr>
<td>$150.01 to $200.00 .. add $19.95</td>
<td>$100.01 to $150.00..add $25.95</td>
</tr>
<tr>
<td>200.01 – above.. add $23.95</td>
<td>$150.01 to $200.00..add $28.95</td>
</tr>
</table>
Thank you so much for your post. I used your code and adjusted it a little to get my answer but your code is better then mine. Here is my code after adjustments:
<table style="border: 1px solid black;">
<tr>
<th style="border: 1px solid black; border-collapse: collapse; padding:5px;">Domestic Shipping and Handling</th>
<th style="border: 1px solid black; border-collapse: collapse; padding:5px;">Canada, AK, HI, PR Shipping and Handling</th>
</tr>
<tr>
<td style="border-right: 1px solid black; padding:5px;"> $25..01 to $50.00..add $7.95 </td>
<td style="padding:5px;"> $.01-$25.00.. add $14.95</td>
</tr>
<tr>
<td style="border-right: 1px solid black; padding:5px;">$50.01 to $75.00...add $11.95</td>
<td style="padding:5px;">$25.01 - $50.00.add $15.95</td>
</tr>
<tr>
<td style="border-right: 1px solid black; padding:5px;">$75.01 to $100.00...add $13.95</td>
<td style="padding:5px;">$50.01 to $75.00...add $18..95</td>
</tr>
<tr>
<td style="border-right: 1px solid black; padding:5px;">$100.01 to $150.00...add $17.95</td>
<td style="padding:5px;">$75.01 to $100.00...add $20.95</td>
</tr>
<tr>
<td style="border-right: 1px solid black; padding:5px;">$150.01 to $200.00 .. add $19.95</td>
<td style="padding:5px;">$100.01 to $150.00..add $25.95</td>
</tr>
<tr>
<td style="border-right: 1px solid black; padding:5px;">200.01 – above.. add $23.95</td>
<td style="padding:5px;">$150.01 to $200.00..add $28.95</td>
</tr>
</table style="border: 1px solid black;">
Hope it helps someone else. I added padding as well to this because the other version was really close together and hard to read.
I'm trying to edit a Wordpress website adding a form. I'm adding this form into a text block writing it in pure html. The thing is when I go to the preview Wordpress deleted the input tags.
I tried looking for someone with the same problem, but I haven't found nothing yet.
Why is this happening?
Here is the code I'm adding into the textblock. The input tags disappear.
Thanks!
<form id="form1" name="form1" method="post" action="http://test.cl/bridge.php">
<table cellspacing="0" style="width:100%">
<tbody>
<tr>
<td style="width:30%; text-align:center; border: 0px solid #ffffff;">
User:
</td>
<td style="width:70%; text-align:center; border: 0px solid #ffffff;">
<input name="nombre" type="text" id="inputNombre" placeholder="User" style="width:90%">
</td>
</tr>
<tr>
<td style="width:30%; text-align:center; border: 0px solid #ffffff;">
Password:
</td>
<td style="width:70%; text-align:center; border: 0px solid #ffffff;">
<input name="pass" type="password" id="inputPass" placeholder="Password" style="width:90%">
</td>
</tr>
<tr>
<td colspan="2" style="border: 0px solid #ffffff;">
<br />
</td>
</tr>
<tr>
<td colspan="2" style="text-align:center; border: 0px solid #ffffff;">
<input type="submit" name="Submit" value="Login" style="border: none !important; width:170px; padding:4px ; font-size:14px; font-weight:bold; background-color: #0CF; color:#069; border-radius:20px;">
</td>
</tr>
<td colspan="2" style="border: 0px solid #ffffff;">
<br />
</td>
<tr>
<td colspan="2" style="text-align:center; border: 0px solid #ffffff;">
<a href="http://test.cl/index.php">
Forgot your password?
</a>
</td>
</tr>
</tbody>
</table>
</form>
I have a simple html code below along with few line css to highlight table row
HTML
<table style="empty-cells:hide;" border="1" cellpadding="1" cellspacing="1">
<tr>
<th>Search?</th><th>Field</th><th colspan="2">Search criteria</th><th>Include in report?<br></th>
</tr>
<tr>
<td class="center">
<input type="checkbox" name="query_myTextEditBox">
</td>
<td>
myTextEditBox
</td>
<td>
<select size ="1" name="myTextEditBox_compare_operator">
<option value="=">equals</option>
<option value="<>">does not equal</option>
</select>
</td>
<td>
<input type="text" name="myTextEditBox_compare_value">
</td>
<td class="center">
<input type="checkbox" name="report_myTextEditBox" value="checked">
</td>
</tr>
</table>
CSS
.
center {
text-align: center;
vertical-align: middle;
}
td, th {
padding: 5px;
}
tr {
height: 25px;
}
tr:hover{
background-color: yellow;
}
the hover property does highlight table row but it excludes child component like input and checkbox.How can I highlight those components when row is hovered
Try this in addition to what you have...
tr:hover input{
background-color: yellow;
}
I've the below HTML Table. and her i want to get only first row border and the rest only column borders only. as given in the screenshot. please let me know how i can do it in my css.
<table cellspacing="1" class="topbotcol">
<thead>
<tr>
<th valign="middle" class="colsep rowsep" align="center">
<span class="font-style-bold">Item</span>
</th>
<th valign="middle" class="colsep rowsep" align="center"> </th>
<th valign="middle" class="colsep rowsep" align="center"> </th>
<th valign="middle" class="colsep rowsep" align="center">
<span class="font-style-bold">Qty</span>
</th>
<th valign="middle" class="colsep rowsep" align="center">
<span class="font-style-bold">Unit</span>
</th>
<th valign="middle" class="colsep rowsep" align="center">
<span class="font-style-bold">Rate $</span>
</th>
</tr>
</thead>
<tbody>
<tr>
<td class="rowsep" align="left"> </td>
<td class="rowsep" align="left">
<div class="para">BUILT-UP WATERPROOF MEMBRANE PANEL ROOFING TO FLAT ROOFS AND POOL DECK</div>
</td>
<td class="rowsep" align="center"> </td>
<td class="rowsep" align="center"> </td>
<td class="rowsep" align="center"> </td>
<td class="rowsep" align="center"> </td>
</tr>
<tr>
<td class="rowsep" align="left"> </td>
<td class="rowsep" align="left">
<div class="para">Preparing surfaces: priming and applying “Grims K1” slurry and “Grims Premier K10” waterproof membrane system as specified</div>
</td>
<td class="rowsep" align="center"> </td>
<td class="rowsep" align="center"> </td>
<td class="rowsep" align="center"> </td>
<td class="rowsep" align="center"> </td>
</tr>
<tr>
<td class="rowsep" align="left"> </td>
<td class="rowsep" align="left">
<div class="para">Membrane collars; pointing with epoxy; reinforced with clamp rings around flanges of rainwater outlets</div>
</td>
<td class="rowsep" align="center"> </td>
<td class="rowsep" align="center"> </td>
<td class="rowsep" align="center"> </td>
<td class="rowsep" align="center"> </td>
</tr>
<tr>
<td class="rowsep" align="left">
<div class="para">A</div>
</td>
<td class="rowsep" align="center">
<div class="para">200mm diameter</div>
</td>
<td class="rowsep" align="center">
<div class="para">13</div>
</td>
<td class="rowsep" align="center">
<div class="para">No.</div>
</td>
<td class="rowsep" align="center">
<div class="para">34.28</div>
</td>
<td class="rowsep" align="center">
<div class="para">445.64</div>
</td>
</tr>
</tbody>
</table>
Thanks
table {
border-top: 1px Solid Black;
border-left: 1px Solid Black;
border-bottom: 1px Solid Black;
border-spacing: 0;
}
th, td {
border-right: 1px Solid Black;
}
th {
background-color: lightgrey;
border-bottom: 1px Solid Black;
}
You can use pseudo classes here:
As your table has th for table headers then you can try this:
table.topbotcol tr:first-of-type{
border-bottom:1px solid #ccc; // Will apply border to first row
}
table.topbotcol tr:first-of-type td{
border:none; // will not apply border to tds of first row, and continue after first row
}
You haven't provided detailed description, i think this might help you!
Pseudo-Classes
Docs
:first-of-type
What you need to do is set a border and set the table border to collapse. This will merge the cell borders. Then remove the unwanted top and bottom borders.
table, th, td{
border: 1px solid #000;
}
table {
border-collapse: collapse;
}
td {
border-bottom: none;
border-top: none;
}
Here's a JSFiddle with a fuller example as well as some more optimizations.
Link to JS Fiddle
Suggestions:
don't use valign or align on table cells, use CSS vertical-align and text-align instead
use paragraph tags instead of <div class="para">
use class names that are descriptive of the content, not its style. This helps with maintenance later when you decide that you do not want something to be font-style-bold anymore. It is easier to change <th> in the CSS than it is to change it in the CSS and THEN go back and change ALL font-style-bold to font-style-normal in your HTML.
You can achieve that by setting the border on the td and th cells, but making the border-top and border-bottom none for the td, but then setting surrounding border of the entire table as well.
The following css is an example:
table {
border-collapse:collapse;
border: 1px solid #000;
}
th {
background-color: #ccc;
border-left: 1px solid #000;
border-bottom: 1px solid #000;
padding: 5px;
}
td {
border-left: 1px solid #000;
padding: 5px;
}
Link to JS Fiddle
Try this
http://jsfiddle.net/aYCjA/
.tbl {
border: 1px solid black;
border-collapse: collapse;
min-width: 300px;
text-align: center;
}
.tbl th, .tbl td {
padding: 2px 5px;
}
.tbl td {
border-left: 1px solid black;
border-right: 1px solid black;
}
.tbl th {
border: 1px solid black;
}
The important thing here is border-collapse: collapse. This attribute prevents showing duplicate borders in sibling cells.