I have a table on my eCommerce checkout that has been recreated below.
I need to expand the width of the "shipping" method cell so that it can better fit the text inside, but also keep the order totals on the right hand side.
If I increase the width of the shipping method cell, it will expand the width of them all which will move the orders totals to the left (I do not want this to happen).
Essentially I need to change the width of the shipping method cell without effecting the other columns.
Any ideas?
/* Restricts outer div container to illustrate problem */
.outer {
width: 400px;
}
<div class="outer">
<table class="shop_table">
<thead>
<tr>
<th class="product-name">Product</th>
<th class="product-total">Total</th>
</tr>
</thead>
<tbody>
<tr class="cart_item">
<td class="product-name">
<div class="product-wrap">
T-Shirts for cool people - size XXL<strong>× 12</strong>
</div>
</td>
<td class="product-total">
$348
</td>
</tr>
</tbody>
<tfoot>
<tr class="cart-subtotal">
<th>Subtotal</th>
<td>$348
</td>
</tr>
<tr class="shipping">
<th>Shipping</th>
<td data-title="Shipping">
<ul id="shipping_method">
<li>
<input type="radio" class="shipping_method">
<label for="shipping_method_1">Standard: Free
<br><small>Estimated delivery by Wednesday Sep 14th</small>
</label>
</li>
<li>
<input type="radio" class="shipping_method">
<label for="shipping_method_2">Expedited: $23
<br><small>Estimated delivery by Tuesday Sep 13th</small>
</label>
</li>
<li>
<input type="radio" class="shipping_method">
<label for="shipping_method_3">Priority: $46
<br><small>Estimated delivery by Tuesday Sep 13th</small>
</label>
</li>
</ul>
</td>
</tr>
<tr class="order-total">
<th>Total</th>
<td><strong>$348</strong>
</td>
</tr>
</tfoot>
</table>
</div>
<div class="outer">
<table class="shop_table">
<thead>
<tr>
<th class="product-name">Product</th>
<th class="product-total">Total</th>
</tr>
</thead>
<tbody>
<tr class="cart_item">
<td class="product-name">
<div class="product-wrap">
T-Shirts for cool people - size XXL<strong>× 12</strong>
</div>
</td>
<td class="product-total">
$348
</td>
</tr>
</tbody>
<tr class="cart-subtotal">
<th>Subtotal</th>
<td>$348
</td>
</tr>
</table>
<table>
<tr class="shipping">
<th>Shipping</th>
<td data-title="Shipping">
<ul id="shipping_method">
<li>
<input type="radio" class="shipping_method">
<label for="shipping_method_1">Standard: Free
<br><small>Estimated delivery by Wednesday Sep 14th</small>
</label>
</li>
<li>
<input type="radio" class="shipping_method">
<label for="shipping_method_2">Expedited: $23
<br><small>Estimated delivery by Tuesday Sep 13th</small>
</label>
</li>
<li>
<input type="radio" class="shipping_method">
<label for="shipping_method_3">Priority: $46
<br><small>Estimated delivery by Tuesday Sep 13th</small>
</label>
</li>
</ul>
</td>
</tr>
</table>
<table>
<tr class="order-total">
<th>Total</th>
<td><strong>$348</strong>
</td>
</tr>
</table>
</div>
/* Restricts outer div container to illustrate problem */
Try this html with css. Code above is by making them as separate tables. You could also make 3 separate table inside a big one.
.outer { width: 400px; }
#shipping_method li {width:340px;}
Related
I added a radio button element to my table. However, it doesn't appear on my page. I took the same exact code and created a snippet and the radio button does appear. Also, I added a background color, just to see where it would be located and it turns out the radio button is covering my text. Does anyone know why this is happening and how to fix it?
EDIT: This is also made under Bootstrap 4.
This how it looked when I added a background color to the radio button.
<div class="row">
<div class="col-25">
<h1>ABC Corp</h1>
<h4>Bill for the month of: June</h4>
<h4>Payment due: 5/10/2020</h4>
<hr />
<table id="billing">
<tr>
<th width="25%">Company</th>
<th width="25%">Plan</th>
<th width="25%">Packages</th>
<th width="25%">Price/pkg</th>
<th>Total</th>
</tr>
<tr>
<td>ACME</td>
<td>Premium</td>
<td>10,000</td>
<td>$0.039</td>
<td>
<div>
<label><input type="radio" id='regular' name="optradio">390.00</label>
</div>
</td>
</tr>
<tr>
<td>NB Distribution</td>
<td>Professional</td>
<td>1,000</td>
<td>$0.049</td>
<td>
<div>
<label><input type="radio" id='regular' name="optradio">49.00</label>
</div>
</td>
</tr>
</table>
<hr>
<p>Balance due <span class="price" style="color:black"><b>$439.00</b></span></p>
<hr >
</div>
</div>
don't enclose your input within the label tag, instead separate those two like below.
<input type="radio" id='regular' name="optradio">
<label for="regular">390.00</label>
You can use display: flex on the label:
label {
display: flex;
}
<div class="row">
<div class="col-25">
<h1>ABC Corp</h1>
<h4>Bill for the month of: June</h4>
<h4>Payment due: 5/10/2020</h4>
<hr />
<table id="billing">
<tr>
<th width="25%">Company</th>
<th width="25%">Plan</th>
<th width="25%">Packages</th>
<th width="25%">Price/pkg</th>
<th>Total</th>
</tr>
<tr>
<td>ACME</td>
<td>Premium</td>
<td>10,000</td>
<td>$0.039</td>
<td>
<div>
<label><input type="radio" id='regular' name="optradio">390.00</label>
</div>
</td>
</tr>
<tr>
<td>NB Distribution</td>
<td>Professional</td>
<td>1,000</td>
<td>$0.049</td>
<td>
<div>
<label><input type="radio" id='regular' name="optradio">49.00</label>
</div>
</td>
</tr>
</table>
<hr>
<p>Balance due <span class="price" style="color:black"><b>$439.00</b></span></p>
<hr>
</div>
</div>
First of all the radio buttons are shown in browser #csb00 and also you have to make different id's for two radio buttons.
I'd like to have table like this:
And I'm trying to do this with bootstrap grid system, but it doesn't work...here is my code. Maybe the problem is with class container? It is correct to put div there?
<table class="table table-bordered" cellpadding="0" cellspacing="0">
<div class="container">
<tr>
<th class="col-sx-6">Avanced Time targetting</th>
<th class="col-xs-1">Midnight<br/>12am</th>
<th class="col-xs-1">4am</th>
<th class="col-xs-1">8am</th>
<th class="col-xs-1">Noon<br/>12pm</th>
<th class="col-xs-1">4pm</th>
<th class="col-xs-1">8pm</th>
</tr>
<tr>
<td class="col-sx-6">
<span>Monday</span>
<ul>
<li>
<button>All days</button>
</li>
<li>
<button>Morning</button>
</li>
<li>
<button>9-5</button>
</li>
<li>
<button>Evening</button>
</li>
<li>
<button>Custom</button>
</li>
<li>
<button>Clear</button>
</li>
<li>
<button>Restore</button>
</li>
</ul>
</td>
<td class="col-xs-1">
<input type="text"/>
</td>
<td class="col-xs-1">
<input type="text"/>
</td>
<td class="col-xs-1">
<input type="text"/>
</td>
<td class="col-xs-1">
<input type="text"/>
</td>
<td class="col-xs-1">
<input type="text"/>
</td>
<td class="col-xs-1">
<input type="text"/>
</td>
</tr>
</div>
Your HTML code is correct but you need to put the container div before the table.
Here is some of basic understanding about bootstrap grid system.
The container div must be outside the table in order for it to align correctly. Furthermore, the structure of your table will align perfectly when you use the theader, tbody and tfooter tags in your table along with the th/td tags.
I am using Bootstrap and have a part in my code that is:
<table class="table">...</table>
In my header, I have the tag <meta name="viewport" content="width=device-width"> This actually works fine(I can see the whole table on my website) but when I add <meta name="viewport" content="width=device-width initial-scale=1"> like is suggested on many websites, my table doesn't fit the 320 px width viewport that I have been using to test and I have to scroll to see the whole table.
Further investigation and playing around with the css for .table shows that I can't manually set width below 385 px. I have tried searching "bootstrap table 385 px" but it doesn't seem like there is anything special about this number so I am wondering why the table can't be smaller. Does anyone have any ideas as to how I can make the table smaller or make it scale correctly to initial-scale=1?
Edit #1:
<table class="table">
<thead>
<tr>
<th>Col1</th>
<th>Col2</th>
<th>Col3</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<input type="checkbox" ng-model="..."> ...
</td>
<td>
<input type="checkbox" ng-model="..."> ...
</td>
<td width=70%>
<input class="form-control" ng-model="...">
</td>
<td>
<button class="btn btn-primary" ng-click="...">...</button>
</td>
</tr>
<tr ng-repeat="... in ...">
<td class="claimedby-{{...}}">
<input type="checkbox" ng-model="..." ng-click="..."> {{...}}
</td>
<td>
<input type="checkbox" ng-model="..." ng-click="..."> ...
</td>
<td>
<div for="...">
<div class="...">{{...}}</div>
</div>
</td>
<td>
<button class="btn btn-danger" ng-click="...">...</button>
</td>
</tr>
</tbody>
</table>
Sorry for the "..." in certain places. I'm not sure if we're allowed to post exact code publicly. Hopefully this is enough to see what's going wrong though.
Here, this should do it for you
<table class="table">
<thead>
<tr>
<th class="col-md-4 col-xs-2">Col1</th>
<th class="col-md-4 col-xs-2">Col2</th>
<th class="col-md-4 col-xs-8">Col3</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<input type="checkbox" ng-model="..."> ...
</td>
<td>
<input type="checkbox" ng-model="..."> ...
</td>
<td>
<input class="form-control" ng-model="...">
</td>
<td>
<button class="btn btn-primary" ng-click="...">...</button>
</td>
</tr>
<tr ng-repeat="... in ...">
<td class="claimedby-{{...}}">
<input type="checkbox" ng-model="..." ng-click="..."> {{...}}
</td>
<td>
<input type="checkbox" ng-model="..." ng-click="..."> ...
</td>
<td>
<div for="...">
<div class="...">{{...}}</div>
</div>
</td>
<td>
<button class="btn btn-danger" ng-click="...">...</button>
</td>
</tr>
</tbody>
</table>
I'm having an weird problem. I've got an table with an input and some text. Only problem is that 1 row is shorter than the others.
I've moved the row down, but that also didn't work. I've also compared them with the other rows, but i can't find the difference.
An image says more than thousands words they say, so here's an screen pick from the live testing area:
Also, here's an JSFiddle of the relevant code.
And here's the code also:
<table class="radio">
<tbody>
<tr class="highlight">
<td>
<input type="radio" name="shipping_method" value="pickup.pickup0" id="shipping_method_pickup" />
</td>
<td colspann="3"><b>Hello</b>
</td>
<td style="text-align: right;">
<label for="pickup.pickup1">0,00</label>
</td>
</tr>
<tr class="highlight">
<td>
<input type="radio" name="shipping_method" value="weight.weight_5" id="weight.weight_5" checked="checked" />
</td>
<td colspan="3"><b>Verzending op gewicht</b>
</td>
<td style="text-align: right;">
<label for="weight.weight_5">2,20</label>
</td>
</tr>
<tr class="highlight">
<td>
<input type="radio" name="shipping_method" value="weighttat.weighttat_5" id="weighttat.weighttat_5" />
</td>
<td colspan="3"><b>Verzending via Post.nl</b>
</td>
<td style="text-align: right;">
<label for="weighttat.weighttat_5">6,75</label>
</td>
</tr>
<tr class="highlight">
<td>
<input type="radio" name="shipping_method" value="dhlpickup.dhlpickup_5" id="dhlpickup.dhlpickup_5" />
</td>
<td colspan="3"><b>Verzenden via DHL Afhaalservice ( Kies hier een DHL afhaalpunt </b>
</td>
<td style="text-align: right;">
<label for="dhlpickup.dhlpickup_5">4,50</label>
</td>
</tr>
</tbody>
</table>
You have a small spelling error
An extra n in colspann
Your first row's attribute colspan is wrong, change:
<td colspann="3"><b>Hello</b>
with:
<td colspan="3"><b>Hello</b>
Here is the fiddle updated: http://jsfiddle.net/D5fJa/1/
More info about colspan attribute: http://www.w3schools.com/tags/att_td_colspan.asp
I have a reservation form on my website, I own a limo company.
But in order to save space on my website I want to know how to make a 2 column form.
This is my form now:
<form method="post" id="myForm" action="send2.php" class="sendmail" onsubmit="return validateForm()" style="text-align:center;">
<h1 class="lead" align="center" style="font-size:35; font-weight:800">RESERVE TRIP</h1>
<ul li><h1 class="lead" align="center" style="color:black;font-weight:bold;list-style:none;">Contact Information</h1></ul li>
<ul li style="list-style:none">
<li>
<link rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" />
<p>
<table>
<td><p><label>Full Name:<input type="text" id="name" name="name" style="margin:10px; width:285px; height:15px"></td>
<td><p><label>Company Name:<input type="text" id="company" name="company" style="margin:10px; width:340px; height:15px"></label></p>
</table>
<table align="center">
<tr>
<td class="width:110px; height:15px">
<p><label>Phone #:<input type="text" id="phone" name="phone" placeholder="###-###-####" style="margin:10px; width:100px; height:15px">
</td>
<td class="width:70px; height:15px">
<p><label>E-mail:<input type="text" id="email" name="email" style="margin:10px; width:220px; height:15px">
</td>
</tr>
<tr>
</td>
</tr>
</table>
</li>
</ul>
<ul li><h1 class="lead" align="center" style="font-weight:bold;color:black;list-style:none">Pick-Up Information</h1></ul li>
<ul li style="list-style:none">
<li>
<option selected="">--</option>
<option>AM</option>
<option>PM</option>
</select></td>
</p>
</table>
<table align="center">
<tr>
<td class="width:110px; height:15px">
<label style="font-size:15px">Airport Name: <span class="error"></span></label>
<td class="width30">
<input type="text" id="rtairport" name="rtairport" class="input85" style="width:180px; margin:10px" value="">
</td>
</td>
<td class="width:110px; height:15px" align="center">
<label style="font-size:15px">Airline/Code:</label>
<td class="width30">
<input type="text" id="rtairline" name="rtairline" class="input85" style="width:75px; margin:10px" value="">
</td>
</td>
<td class="width:70px; height:15px">
<label style="font-size:15px">Flight #:</label>
<td class="width30">
<input type="text" id="rtfnumber" name="rtfnumber" class="input85" style="width:40px;margin:10px" value="">
</td>
</td>
</tr>
<tr>
<td>
</tr>
</td>
</table>
<br>
<li><h1 class="lead" align="center" style="font-weight:bold;color:black;list-style:none">Drop-Off Information</h1></li>
<ul li style="list-style:none">
<center><p><label>Full Address:<input type="text" id="rtstreet" name="rtstreet" style="margin:10px; width:360px; height:15px"></label></p></center>
<table align="center">
<tr>
<td class="width:110px; height:15px">
<label style="font-size:15px">Airport Name: <span class="error"></span></label>
<td class="width30">
<input type="text" id="doairport" name="doairport" class="input85" style="width:200px; margin:10px" value="">
</td>
</td>
<td class="width:110px; height:15px" align="center">
<label style="font-size:15px">Airline/Code:</label>
<td class="width30">
<input type="text" id="doairline" name="doairline" class="input85" style="width:75px; margin:10px" value="">
</td>
</td>
<td class="width:70px; height:15px">
<label style="font-size:15px">Flight #:</label>
<td class="width30">
<input type="text" id="dofnumber" name="dofnumber" class="input85" style="width:40px;margin:10px" value="">
</td>
</table>
</div>
</ul></li>
Any help/advice would help. Thank you.
Put the form fields in two separate divs and float them left. Also make sure to set their widths and to make them fit next to each other.
Make two <div>s. These will be the two columns. Then, in their css, add float: left. If you need any more help, just ask.
What browsers do you need to support? If you're OK using semi-experimental CSS3 features that won't work in older browsers, just use CSS3 columns.
it looks like you need some work with your tables
a general table format might look like
<form action="checkInput.php" method="POST">
<table border="1px solid #C00">
<tr>
<th colspan="2">Table Heading</th>
</tr>
<tr>
<td>Column 1</td><td>Column 2</td>
</tr>
<tr>
<td>An Input for Column 1
<input class="inputCSS" type="text" id="col1input" placeholder="Input Column 1" />
</td>
<td>An Input for Column 2
<input class="inputCSS" type="text" id="col2input" placeholder="Input Column 2" />
</td>
</tr>
<tr>
<td>Another row down for<br>Column 1</td><td>Another row down for<br>Column 2</td>
</tr>
</table>
</form>
this example shows a title "Table Heading" and 3 rows by 2 columns. if you follow the pattern with the <tr> (table rows) and <td> (individual cells) you can expand on this 2 column format. Then you can tweak it to your preference. Also, keep the columns you want lined up in the same tables so the browser lines them up for you
once you start to understand how to type tables, a 2 column form won't be hard.