CSS Custom Radio Buttons don't work properly - html

I'm trying to build my custom radio buttons. I want them to just have a bigger, white border and when the radio button is checked I want to have a white dot in it. Like so:
https://ibb.co/iBjJHk
But it's not working, I can't check the radio button anymore...
I'm searching for a pure CSS solution if possible.
Here is what I tried so far, the relevant part is at the top of the CSS.
https://codepen.io/Insane415/pen/zzoBmp
HTML
<table class="pricing-table">
<tr>
<td id="table-heading"><h1>Leistungen & Preise Telefonservice</h2></td>
<td>
<label for="test">AllIn-Order</label>
<input type="radio" id="test" name="tarif-top">
</td>
<td class="red-background">AllIn-Time<br>
<input type="radio" checked name="tarif-top" value="allin-time"/></td>
<td>AllIn-Contact<br>
<input type="radio" name="tarif-top" value="allin-contact"/></td>
<td>
Enterprise<br>
<input type="radio" name="tarif-top" value="enterprise"/>
</td>
</tr>
<tr>
<td>Monatliche Grundgebühr</td>
<td colspan="3">nur 59,90€</td>
<td>individuell</td>
</tr>
<tr>
<td>Telefonische Annahmezeit</td>
<td colspan="3">Mo-Fr 08:00 bis 19:00 Uhr</td>
<td>24/7</td>
</tr>
<tr>
<td>Kosten pro Minute/Kontakt</td>
<td>0,69€/Minute</td>
<td class="red-background">0,89€/Minute</td>
<td>3,00€/Kontakt</td>
<td>individuell</td>
</tr>
<tr>
<td>Transaktionsgebühren</td>
<td>12,5%/Bestellung</td>
<td class="red-background">—</td>
<td>—</td>
<td>individuell</td>
</tr>
<tr id="services">
<td>Enthaltene Leistungen</td>
</tr>
<tr>
<td>Englischsprachiger Telefonservice</td>
<td colspan="3">Check</td>
<td>Check</td>
</tr>
<tr>
<td>Kundenservice für Markplätze</td>
<td colspan="3">Check</td>
<td>Check</td>
</tr>
<tr>
<td>Bestellannahme für Waren</td>
<td colspan="3">Check</td>
<td>Check</td>
</tr>
<tr>
<td>Anrufnotiz via E-Mail</td>
<td colspan="3">Check</td>
<td>Check</td>
</tr>
<tr>
<td>Anrufnotiz via E-Mail</td>
<td colspan="3">Check</td>
<td>Check</td>
</tr>
<tr>
<td>Monatliches Reporting</td>
<td colspan="3">Check</td>
<td>Check</td>
</tr>
<tr>
<td>Weiterleitung Festnetz (DE)</td>
<td colspan="3">0,09€/Minute</td>
<td>Check</td>
</tr>
<tr>
<td>Weiterleitung Mobilfunknetz (DE)</td>
<td colspan="3">0,25€/Minute</td>
<td>Check</td>
</tr>
<tr>
<td>Buchungsannahme</td>
<td colspan="3">—</td>
<td>Check</td>
</tr>
<tr>
<td>Outbound-Kampagnen</td>
<td colspan="3">—</td>
<td>Check</td>
</tr>
<tr>
<td></td>
<td>
<input type="radio" value="allin-order" name="tarif-bottom"/>
<br>AllIn-Order
</td>
<td class="red-background">
<input type="radio" checked name="tarif-bottom" value="allin-time"/>
<br>AllIn-Time
</td>
<td>
<input type="radio" name="tarif-bottom" value="allin-contact"/>
<br>AllIn-Contact
</td>
<td>
<input type="radio" name="tarif-bottom" value="enterprise"/>
<br>Enterprise
</td>
</tr>
</table>
CSS
/*BEGIN Custom Radio Button*/
#test{
display: none;
}
label:before{
content: '';
width: 25px;
height: 25px;
border: 3px solid white;
display: inline-block;
border-radius: 100%;
position: absolute;
top: 50px;
}
input[type="radio"]:checked + label:after{
content: '';
width: 15px;
height: 15px;
border-radius: 100%;
background-color: white;
display: inline-block;
}
label:hover{
cursor: pointer;
}
/*END Custom Radio Button*/
.pricing-table{
text-align: center;
}
.pricing-table td{
background-color: #ccc;
padding: 12px;
}
.pricing-table tr td:first-child{
background-color: #ddd;
text-align: left;
}
.pricing-table tr td:last-child{
}
.pricing-table tr:last-child td:first-child{
background-color: white;
}
.pricing-table #services td, #table-heading{
font-weight: 600;
background-color: white;
}
.pricing-table tr:first-child td:nth-of-type(1n+2), .pricing-table tr:last-child td {
background-color: #545067;
color: white;
}
.red-background{
color: white!important;
background-color: #E22C26!important;
}
/* BEGIN Radio Buttons*/
/*END Radio Buttons*/
.tarif-choice hr{
border-color: #E22C26;
}
ul.optional {
background-color: #ddd;
padding: 0;
}
ul.optional input{
margin-right: 10px;
margin-left: 15px;
}
ul.optional li{
list-style-type: none;
border-top: 1px solid silver;
}
ul.optional p{
margin-left: 30px;
margin-top: 0;
margin-bottom: 0;
}
ul.optional p:before {
content: "•";
margin-right: 6px;
}
.checkbox-holder{
margin-left: 25px;
}
.checkbox-holder .checkbox-space{
margin-left: 50px;
}

Please see below. Added CSS for label and fixed a few settings for label:after. Since your CSS uses input + label, it is important input is specified before the label in your HTML (changed below).
$('input[type="radio"]').change(function(){
if($(this).val()=='allin-order'){
$(":radio[value=allin-order]").prop("checked", true);
$(".pricing-table td").removeClass("red-background");
$(".pricing-table tr:first-child td:nth-of-type(2)").addClass("red-background");
$(".pricing-table tr:nth-of-type(4) td:nth-of-type(2)").addClass("red-background");
$(".pricing-table tr:nth-of-type(5) td:nth-of-type(2)").addClass("red-background");
$(".pricing-table tr:last-child td:nth-of-type(2)").addClass("red-background");
};
if($(this).val()=='allin-time'){
$(":radio[value=allin-time]").prop("checked", true);
$(".pricing-table td").removeClass("red-background");
$(".pricing-table tr:first-child td:nth-of-type(3)").addClass("red-background");
$(".pricing-table tr:nth-of-type(4) td:nth-of-type(3)").addClass("red-background");
$(".pricing-table tr:nth-of-type(5) td:nth-of-type(3)").addClass("red-background");
$(".pricing-table tr:last-child td:nth-of-type(3)").addClass("red-background");
};
if($(this).val()=='allin-contact'){
$(":radio[value=allin-contact]").prop("checked", true);
$(".pricing-table td").removeClass("red-background");
$(".pricing-table tr:first-child td:nth-of-type(4)").addClass("red-background");
$(".pricing-table tr:nth-of-type(4) td:nth-of-type(4)").addClass("red-background");
$(".pricing-table tr:nth-of-type(5) td:nth-of-type(4)").addClass("red-background");
$(".pricing-table tr:last-child td:nth-of-type(4)").addClass("red-background");
};
if($(this).val()=='enterprise'){
$(":radio[value=enterprise]").prop("checked", true);
$(".pricing-table td").removeClass("red-background");
$(".pricing-table tr:first-child td:nth-of-type(5)").addClass("red-background");
$(".pricing-table tr:nth-of-type(4) td:nth-of-type(5)").addClass("red-background");
$(".pricing-table tr:nth-of-type(5) td:nth-of-type(5)").addClass("red-background");
$(".pricing-table tr:last-child td:nth-of-type(5)").addClass("red-background");
};
});
/*BEGIN Custom Radio Button*/
#test{
display: none;
}
label { display: inline-block; position: relative; }
label:after{
content: '';
width: 25px;
height: 25px;
border: 3px solid white;
border-radius: 50%;
position: absolute;
top: 25px;
right: 25px;
}
input[type="radio"]:checked + label:after{
content: '';
width: 25px;
height: 25px;
border: 3px solid white;
border-radius: 50%;
background: white;
display: inline-block;
}
label:hover{
cursor: pointer;
}
/*END Custom Radio Button*/
.pricing-table{
text-align: center;
}
.pricing-table td{
background-color: #ccc;
padding: 12px;
}
.pricing-table tr td:first-child{
background-color: #ddd;
text-align: left;
}
.pricing-table tr td:last-child{
}
.pricing-table tr:last-child td:first-child{
background-color: white;
}
.pricing-table #services td, #table-heading{
font-weight: 600;
background-color: white;
}
.pricing-table tr:first-child td:nth-of-type(1n+2), .pricing-table tr:last-child td {
background-color: #545067;
color: white;
}
.red-background{
color: white!important;
background-color: #E22C26!important;
}
/* BEGIN Radio Buttons*/
/*END Radio Buttons*/
.tarif-choice hr{
border-color: #E22C26;
}
ul.optional {
background-color: #ddd;
padding: 0;
}
ul.optional input{
margin-right: 10px;
margin-left: 15px;
}
ul.optional li{
list-style-type: none;
border-top: 1px solid silver;
}
ul.optional p{
margin-left: 30px;
margin-top: 0;
margin-bottom: 0;
}
ul.optional p:before {
content: "•";
margin-right: 6px;
}
.checkbox-holder{
margin-left: 25px;
}
.checkbox-holder .checkbox-space{
margin-left: 50px;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<table class="pricing-table">
<tr>
<td id="table-heading"><h1>Leistungen & Preise Telefonservice</h2></td>
<td>
<input type="radio" id="test" name="tarif-top">
<label for="test">AllIn-Order</label>
</td>
<td class="red-background">AllIn-Time<br>
<input type="radio" checked name="tarif-top" value="allin-time"/></td>
<td>AllIn-Contact<br>
<input type="radio" name="tarif-top" value="allin-contact"/></td>
<td>
Enterprise<br>
<input type="radio" name="tarif-top" value="enterprise"/>
</td>
</tr>
<tr>
<td>Monatliche Grundgebühr</td>
<td colspan="3">nur 59,90€</td>
<td>individuell</td>
</tr>
<tr>
<td>Telefonische Annahmezeit</td>
<td colspan="3">Mo-Fr 08:00 bis 19:00 Uhr</td>
<td>24/7</td>
</tr>
<tr>
<td>Kosten pro Minute/Kontakt</td>
<td>0,69€/Minute</td>
<td class="red-background">0,89€/Minute</td>
<td>3,00€/Kontakt</td>
<td>individuell</td>
</tr>
<tr>
<td>Transaktionsgebühren</td>
<td>12,5%/Bestellung</td>
<td class="red-background">—</td>
<td>—</td>
<td>individuell</td>
</tr>
<tr id="services">
<td>Enthaltene Leistungen</td>
</tr>
<tr>
<td>Englischsprachiger Telefonservice</td>
<td colspan="3">Check</td>
<td>Check</td>
</tr>
<tr>
<td>Kundenservice für Markplätze</td>
<td colspan="3">Check</td>
<td>Check</td>
</tr>
<tr>
<td>Bestellannahme für Waren</td>
<td colspan="3">Check</td>
<td>Check</td>
</tr>
<tr>
<td>Anrufnotiz via E-Mail</td>
<td colspan="3">Check</td>
<td>Check</td>
</tr>
<tr>
<td>Anrufnotiz via E-Mail</td>
<td colspan="3">Check</td>
<td>Check</td>
</tr>
<tr>
<td>Monatliches Reporting</td>
<td colspan="3">Check</td>
<td>Check</td>
</tr>
<tr>
<td>Weiterleitung Festnetz (DE)</td>
<td colspan="3">0,09€/Minute</td>
<td>Check</td>
</tr>
<tr>
<td>Weiterleitung Mobilfunknetz (DE)</td>
<td colspan="3">0,25€/Minute</td>
<td>Check</td>
</tr>
<tr>
<td>Buchungsannahme</td>
<td colspan="3">—</td>
<td>Check</td>
</tr>
<tr>
<td>Outbound-Kampagnen</td>
<td colspan="3">—</td>
<td>Check</td>
</tr>
<tr>
<td></td>
<td>
<input type="radio" value="allin-order" name="tarif-bottom"/>
<br>AllIn-Order
</td>
<td class="red-background">
<input type="radio" checked name="tarif-bottom" value="allin-time"/>
<br>AllIn-Time
</td>
<td>
<input type="radio" name="tarif-bottom" value="allin-contact"/>
<br>AllIn-Contact
</td>
<td>
<input type="radio" name="tarif-bottom" value="enterprise"/>
<br>Enterprise
</td>
</tr>
</table>
<!-- END table -->
<h2>Buchungsübersicht</h2>
<div class="row">
<div class="col-md-6">
<div class="tarif-choice">
<p>Ihre Tarifauswahl</p>
<hr/>
<div class="allin-time">
<ul>
<li>mtl. Grundgebühr 59,90€</li>
<li>0,89€/Minute</li>
<li>Servicezeit: Mo-Fr 08:00-19:00 Uhr</li>
</ul>
<ul class="check">
<li>Mehrsprachiger Telefonservice</li>
<li>Bestellannahme für Waren</li>
<li>Buchungsannahme</li>
<li>Anrufnotiz via E-Mail</li>
<li>Monatliches Reporting</li>
<li>Einzelverbindungsnachweis</li>
</ul>
</div>
</div>
</div>
<div class="col-md-6">
<p>Optionale Leistungen | | Diese Leistungen werden nur abgerechnet,
soweit Sie sich aktiv für den Service entschieden haben
<ul class="optional">
<li><input type="checkbox"/>Service Zeit 24/7
<p class="dot">Kosten: 19,90 €/E-Mail</p>
</li>
<li><input type="checkbox"/>Anrufnotiz via SMS
<p class="dot">Kosten: 0,20 €/SMS</p>
</li>
<li><input type="checkbox"/>E-Mail-Service
<p class="dot">Servicezeit: Mo-Fr 08:00-19:00 Uhr</p>
<p class="dot">Kosten: 4,49 €/E-Mail</p>
</li>
<li><input type="checkbox"/>Chat-Service
<p class="dot"/>Live-Chat. WhatsApp & Facebook-Messenger Service</p>
<p class="dot"/>Servicezeit: Mo-Fr 08:00-19:00 Uhr</p>
<p class="dot"/>Kosten (2 Abrechnungsmodelle möglich): </p>
<div class="checkbox-holder">
<input type="checkbox"/>5,49€/Chat
<span class="checkbox-space"><input type="checkbox"/>0,69€/Minute</span>
</div>
</li>
<li><input type="checkbox"/>Click-to-Message Service
<p class="dot"/>Servicezeit: Mo-Fr 08:00-19:00 Uhr</p>
<p class="dot">0,20 €/SMS</p>
</li>
</ul>
</div>
</div>

Related

Replicate Excel custom table using css + html

I want to replicate a table using CSS + HTML
So everything goes well until last part.
Table:
So I try:
#page {
background: #ffffff;
width: 878px;
margin: 0 auto;
margin-top: 40px;
display: block;
border: 1px solid #c4c7c7;
padding: 40px 40px 50px 40px;
position: relative;
z-index: 0;
}
.ship-table {
border-collapse: collapse;
}
.ship-table--title {
border-bottom: 3px solid;
border-top: 3px solid;
text-align: center;
background-color: #d3d3d3;
}
.ship-table--text_center {
text-align: center;
}
.ship-table--divider {
border-right: 3px solid;
border-left: 3px solid;
}
.ship-table--bottom {
border-bottom: 3px solid;
border-right: 3px solid;
}
.ship-table--image {
border-top: 3px solid;
border-right: 3px solid;
}
.ship-table--carrier {
background-color: #339933;
text-align: center;
}
.ship-table--due-box {
border: 3px solid;
}
.ship-table--dueDate {
background-color: #FFFF00;
}
.ship-table--dueDate_value {
font-size: 48px;
}
.ship-table--dueDate_field {
border: 3px solid;
border-color: red;
padding-bottom: 25px;
}
.ship-table--bol_value {
font-size: 28px;
}
<table class="ship-table">
<tbody>
<tr>
<td class="ship-table--title ship-table--divider">SHIP FROM</td>
<td class="ship-table--image" rowspan="2">pic here</td>
</tr>
<tr>
<td class="ship-table--divider">
{{ShipFromCompany}}
<br /> {{ShipFromAddressLineOne}}
<br /> {{ShipFromAddressLineTwo}}, {{ShipFromPostalCode}}
<br /> {{ShipFromAttn}}
<br /> {{ShipFromPhone}}
</td>
</tr>
<tr>
<td class="ship-table--title ship-table--divider">SHIP TO</td>
<td class="ship-table--title ship-table--divider">Carrier Name:</td>
</tr>
<tr>
<td class="ship-table--divider">
{{ShipToCompany}}
<br /> {{ShipToAddressLineOne}}
<br /> {{ShipToAddressLineTwo}}, {{ShipToPostalCode}}
<br /> {{ShipToAttn}}
<br /> {{ShipToPhone}}
</td>
<td class="ship-table--due-box">
<div class="ship-table--carrier ship-table--due-box ship-table--text_center">
{{ShipToCarrier}}
</div>
<div class="ship-table--dueDate ship-table--due-box ship-table--text_center">
DUE DATE:
</div>
<div class="ship-table--dueDate_value ship-table--dueDate_field ship-table--text_center">
{{ShipToDueDate}}
</div>
</td>
</tr>
<tr>
<td class="ship-table--title ship-table--divider">SHIPPER</td>
<td>
<div class="ship-table--title ship-table--divider">
BILL OF LADING NUMBER
</div>
<div class="ship-table--bol_value ship-table--text_center ship-table--divider">
{{BillOfLadingNumber}}
</div>
</td>
</tr>
<tr class="ship-table--bottom">
<td class="ship-table--divider">
{{ShipperCompany}}
<br /> {{ShipperAttn}}
<br /> {{ShipperAddressLineOne}}
<br /> {{ShipperAddressLineTwo}}
</td>
<td></td>
</tr>
</tbody>
</table>
How can I change nested borders to be part of the original colum, date be bigger than and the Bill Of ladding number at the bottom?
For nested borders I use border-colapse: colapse but it does not work.
Here is an easy solution. You can follow it.
#page {
background: #ffffff;
width: 878px;
margin: 0 auto;
margin-top: 40px;
display: block;
border: 1px solid #c4c7c7;
padding: 40px 40px 50px 40px;
position: relative;
z-index: 0;
}
.ship-table {
border-collapse: collapse;
width: 100%;
}
.ship-table tr, .ship-table td{
border: 1px solid #000;
}
.ship-table-table{
width: 100%;
}
.ship-table-table tr, .ship-table-table td{
border:0;
}
.ship-table--title {
border-bottom: 1px solid;
text-align: center;
background-color: #d3d3d3;
}
.ship-table--title-green{
border-top: 1px solid;
border-bottom: 1px solid;
text-align: center;
background-color: #339933;
}
.ship-table--title-yellow{
border-bottom: 1px solid;
text-align: center;
background-color: #FFFF00;
}
.ship-table--title-red{
border: 1px solid red !important;
text-align: center;
padding: 30px 0;
}
.ship-table--dueDate_value {
font-size: 48px;
text-align: center;
}
.ship-table--bol_value {
font-size: 28px;
text-align: center;
}
<div id="page">
<table class="ship-table" cellpadding="0" cellspacing="0">
<tr>
<td valign="top">
<table class="ship-table-table" cellpadding="0" cellspacing="0">
<tr>
<th class="ship-table--title">
SHIP FROM
</th>
</tr>
<tr>
<td>
{{ShipFromCompany}}
<br /> {{ShipFromAddressLineOne}}
<br /> {{ShipFromAddressLineTwo}}, {{ShipFromPostalCode}}
<br /> {{ShipFromAttn}}
<br /> {{ShipFromPhone}}
</td>
</tr>
</table>
</td>
<td>
pic here
</td>
</tr>
<tr>
<td valign="top">
<table class="ship-table-table" cellpadding="0" cellspacing="0">
<tr>
<th class="ship-table--title">
SHIP TO
</th>
</tr>
<tr>
<td>
{{ShipToCompany}}
<br /> {{ShipToAddressLineOne}}
<br /> {{ShipToAddressLineTwo}}, {{ShipToPostalCode}}
<br /> {{ShipToAttn}}
<br /> {{ShipToPhone}}
</td>
</tr>
</table>
</td>
<td valign="top" rowspan="2">
<table class="ship-table-table" cellpadding="0" cellspacing="0">
<tr>
<th class="ship-table--title">
Carrier Name:
</th>
</tr>
<tr>
<td>
CASC
</td>
</tr>
</table>
<table class="ship-table-table" cellpadding="0" cellspacing="0">
<tr>
<th class="ship-table--title-green">
{{ShipToCarrier}}
</th>
</tr>
<tr>
<th class="ship-table--title-yellow">
DUE DATE:
</th>
</tr>
<tr>
<td class="ship-table--title-red ship-table--dueDate_value">
{{ShipToDueDate}}
</td>
</tr>
</table>
<table class="ship-table-table" cellpadding="0" cellspacing="0">
<tr>
<th class="ship-table--title">
BILL OF LADING NUMBER
</th>
</tr>
<tr>
<td class="ship-table--bol_value">
{{BillOfLadingNumber}}
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td valign="top">
<table class="ship-table-table" cellpadding="0" cellspacing="0">
<tr>
<th class="ship-table--title">
SHIPPER
</th>
</tr>
<tr>
<td>
{{ShipperCompany}}
<br /> {{ShipperAttn}}
<br /> {{ShipperAddressLineOne}}
<br /> {{ShipperAddressLineTwo}}
</td>
</tr>
</table>
</td>
</tr>
</table>
</div>
There is no neat way to do this. You have to rely on css hacks to fix the borders. Also I couldn't fix bottom right corner cell
Here's a temporary fix to the nested border issue (except for the last column in the lastrow)
Changes have been highlighted with comments (Also note, I do not recommend this method, I am just giving you an idea of the nested border issue and tricks to overlap them)
<!DOCTYPE html>
<html>
<head>
<title>Page Title</title>
<style>
#page {
background: #ffffff;
width: 878px;
margin: 0 auto;
margin-top: 40px;
display: block;
border: 1px solid #c4c7c7;
padding: 40px 40px 50px 40px;
position: relative;
z-index: 0;
}
.ship-table {
border-collapse: collapse;
}
.ship-table--title {
border-bottom: 3px solid;
border-top: 3px solid;
text-align: center;
background-color: #d3d3d3;
}
.ship-table--text_center {
text-align: center;
}
.ship-table--divider {
border-right: 3px solid;
border-left: 3px solid;
}
.ship-table--bottom {
border-bottom: 3px solid;
border-right: 3px solid;
}
.ship-table--image {
border-top: 3px solid;
border-right: 3px solid;
}
.ship-table--carriership-table--carrier {
background-color: #339933;
text-align: center;
}
.ship-table--due-box {
border-right: 3px solid; /*changes */
}
.ship-table--carrier {
border-right:none; /* changes*/
}
.ship-table--dueDate {
background-color: #FFFF00;
border-right: none; /*changes*/
}
.ship-table--dueDate_value {
font-size: 48px;
/*changes*/
position: relative;
margin-left: -4px;
margin-right: -4px;
margin-bottom: -2px;
}
.ship-table--dueDate_field {
border: 3px solid;
border-color: red;
padding-bottom: 25px;
}
.ship-table--bol_value {
font-size: 28px; /*changes*/
border-left: none;
position: relative;
margin-right: -2px;
}
.table-border-fix { /* new class to fix the borders in bottom column*/
border: 3px solid;
position: relative;
margin-left: -4px;
margin-right: -2px;
border-top: none;
}
</style>
</head>
<body>
<table class="ship-table">
<tbody>
<tr>
<td class="ship-table--title ship-table--divider">SHIP FROM</td>
<td class="ship-table--image" rowspan="2">pic here</td>
</tr>
<tr>
<td class="ship-table--divider">
{{ShipFromCompany}}
<br /> {{ShipFromAddressLineOne}}
<br /> {{ShipFromAddressLineTwo}}, {{ShipFromPostalCode}}
<br /> {{ShipFromAttn}}
<br /> {{ShipFromPhone}}
</td>
</tr>
<tr>
<td class="ship-table--title ship-table--divider">SHIP TO</td>
<td class="ship-table--title ship-table--divider">Carrier Name:</td>
</tr>
<tr>
<td class="ship-table--divider">
{{ShipToCompany}}
<br /> {{ShipToAddressLineOne}}
<br /> {{ShipToAddressLineTwo}}, {{ShipToPostalCode}}
<br /> {{ShipToAttn}}
<br /> {{ShipToPhone}}
</td>
<td class="ship-table--due-box">
<div class="ship-table--carrier ship-table--due-box ship-table--text_center">
{{ShipToCarrier}}
</div>
<div class="ship-table--dueDate ship-table--due-box ship-table--text_center">
DUE DATE:
</div>
<div class="ship-table--dueDate_value ship-table--dueDate_field ship-table--text_center">
{{ShipToDueDate}}
</div>
</td>
</tr>
<tr>
<td class="ship-table--title ship-table--divider">SHIPPER</td>
<td>
<!-- introduced new class table-border-fix to below 2 divs-->
<div class="ship-table--title ship-table--divider table-border-fix">
BILL OF LADING NUMBER
</div>
<div class="ship-table--bol_value ship-table--text_center ship-table--divider">
{{BillOfLadingNumber}}
</div>
</td>
</tr>
<tr class="ship-table--bottom">
<td class="ship-table--divider">
{{ShipperCompany}}
<br /> {{ShipperAttn}}
<br /> {{ShipperAddressLineOne}}
<br /> {{ShipperAddressLineTwo}}
</td>
</body>
</html>
References: Nested divs: how can I get overlapping borders?

Show tooltip(in span) always top in table

Hello I have a table and I made a tooltip with CSS
its shows up when u hover mouse on <td>
here's my jsfiddle : www.jsfiddle.net/4qzurb5w/
How can I make this tooltip always shows up everything in table?
Get rid of this block, it is conflicting:
.green:hover,
.blue:hover,
.red:hover,
.yellow:hover,
.black:hover {
opacity: 0.8;
}
It should work then.
I moved your opacity style to .tooltip .tooltiptext, see stack snippet.
.tooltip {
position: relative;
display: inline-block;
border-bottom: 1px dotted black;
}
.tooltip .tooltiptext {
visibility: hidden;
width: 120px;
background-color: black;
color: #fff;
text-align: center;
border-radius: 6px;
padding: 5px 0;
opacity: 0.8; /* <-- I added your opacity here */
/* Position the tooltip */
position: absolute;
z-index: 1;
top: 100%;
left: 50%;
margin-left: -60px;
}
.tooltip:hover .tooltiptext {
visibility: visible;
}
.div table {
font-family: Arial, Helvetica, sans-serif;
color: #666;
font-size: 10px;
text-shadow: 1px 1px 0px #fff;
background: #eaebec;
border: #ccc 1px solid;
-moz-border-radius: 3px;
-webkit-border-radius: 3px;
border-radius: 3px;
-moz-box-shadow: 0 1px 2px #d1d1d1;
-webkit-box-shadow: 0 1px 2px #d1d1d1;
box-shadow: 0 1px 2px #d1d1d1;
}
.div table caption {
font-weight: bold;
font-size: 11px;
}
.div td {
min-width: 100px;
text-align: center;
padding: 5px;
border-top: 1px solid #ffffff;
border-bottom: 1px solid #e0e0e0;
border-left: 1px solid #e0e0e0;
background: #fafafa;
background: -webkit-gradient(linear, left top, left bottom, from(#fbfbfb), to(#fafafa));
background: -moz-linear-gradient(top, #fbfbfb, #fafafa);
}
.red {
background: #940000 !important;
color: White !important;
text-shadow: 1px 1px 0px #000000;
}
.blue {
background: #1C2CFA !important;
color: White !important;
text-shadow: 1px 1px 0px #000000;
}
.black {
background: #000000 !important;
color: White !important;
text-shadow: 1px 1px 0px #000000;
}
.yellow {
background: #009999 !important;
color: Green !important;
text-shadow: 1px 1px 0px #000000;
}
.white {
background: #fafafa !important;
color: #666 !important;
}
.grey {
background: #808080 !important;
color: White !important;
text-shadow: 1px 1px 0px #000000;
}
.ariza {
background: #990000 !important;
color: White !important;
text-shadow: 1px 1px 0px #000000;
}
.green {
background: #00941C !important;
color: White !important;
text-shadow: 1px 1px 0px #000000;
}
.green:hover,
.blue:hover,
.red:hover,
.yellow:hover,
.black:hover {
/* opacity: 0.8; get rid of this */
}
.green a,
.blue a,
.red a,
.yellow a,
.black a {
display: block;
color: White;
text-decoration: none;
}
.yazitd {
width: 70px !important;
}
.sagtd {
width: 540px !important;
}
.tarihtd {
width: 160px !important;
}
.style3 {
width: 90px;
}
.style4 {
height: 19px;
}
.style5 {
width: 40px;
}
.style6 {
width: 40px;
height: 23px;
}
.style7 {
height: 23px;
}
<table>
<tbody>
<tr>
<td style="vertical-align: middle; min-width: 50px !important; font-weight: bold;">KAT 1 </td>
<td>
<table>
<tbody>
<tr>
<td style="vertical-align: top;">
</td>
</tr>
<tr>
<td class="red tooltip">Daire No:1
<div><span class="tooltiptext">ALEX DE SOUZA<br>HASAN ALİ KALDIRIM<br>ALPER POTUK<br>RIDVAN DİLMEN<br></span></div>
</td>
</tr>
</tbody>
</table>
</td>
<td>
<table>
<tbody>
<tr>
<td style="vertical-align: top;">
</td>
</tr>
<tr>
<td class="green tooltip">Daire No:2
<div><span class="tooltiptext"></span></div>
</td>
</tr>
</tbody>
</table>
</td>
<td>
<table>
<tbody>
<tr>
<td style="vertical-align: top;">
</td>
</tr>
<tr>
<td class="red tooltip">Daire No:3
<div><span class="tooltiptext">ALİ KOÇ<br></span></div>
</td>
</tr>
</tbody>
</table>
</td>
<td>
<table>
<tbody>
<tr>
<td style="vertical-align: top;">
</td>
</tr>
<tr>
<td class="green tooltip">Daire No:4
<div><span class="tooltiptext"></span></div>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr>
<td style="vertical-align: middle; min-width: 50px !important; font-weight: bold;">KAT 2 </td>
<td>
<table>
<tbody>
<tr>
<td style="vertical-align: top;">
</td>
</tr>
<tr>
<td class="green tooltip" style="font-weight: 400;">Daire No:5
<div><span class="tooltiptext"></span></div>
</td>
</tr>
</tbody>
</table>
</td>
<td>
<table>
<tbody>
<tr>
<td style="vertical-align: top;">
</td>
</tr>
<tr>
<td class="green tooltip">Daire No:6
<div><span class="tooltiptext"></span></div>
</td>
</tr>
</tbody>
</table>
</td>
<td>
<table>
<tbody>
<tr>
<td style="vertical-align: top;">
</td>
</tr>
<tr>
<td class="green tooltip">Daire No:7
<div><span class="tooltiptext"></span></div>
</td>
</tr>
</tbody>
</table>
</td>
<td>
<table>
<tbody>
<tr>
<td style="vertical-align: top;">
</td>
</tr>
<tr>
<td class="green tooltip">Daire No:8
<div><span class="tooltiptext"></span></div>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr>
<td style="vertical-align: middle; min-width: 50px !important; font-weight: bold;">KAT 3 </td>
<td>
<table>
<tbody>
<tr>
<td style="vertical-align: top;">
</td>
</tr>
<tr>
<td class="green tooltip">Daire No:9
<div><span class="tooltiptext"></span></div>
</td>
</tr>
</tbody>
</table>
</td>
<td>
<table>
<tbody>
<tr>
<td style="vertical-align: top;">
</td>
</tr>
<tr>
<td class="green tooltip">Daire No:10
<div><span class="tooltiptext"></span></div>
</td>
</tr>
</tbody>
</table>
</td>
<td>
<table>
<tr>
<td style="vertical-align: top;">
</td>
</tr>
<tr>
<td class="green tooltip">Daire No:11
<div><span class="tooltiptext"></span></div>
</td>
</tr>
</table>
</td>
<td>
<table>
<tbody>
<tr>
<td style="vertical-align: top;">
</td>
</tr>
<tr>
<td class="green tooltip">Daire No:12
<div><span class="tooltiptext"></span></div>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>

CSS class selector not working but tag and class selector does

When I use a class selector to modify the width of an element it does not work. When I use a tag and class selector as in table.change-name it does work.
HTML:
<!-- start settings -->
<div class='settings'>
<h4>Account Settings</h4>
<table class='options'>
<tr>
<td class='name username'>Name</td>
<td class='value'>Robert Rocha</td>
<td class='edit'><a href='#'>Edit</a></td>
</tr>
<tr>
<td class='name email'>Email</td>
<td class='value'>tom#gmail.com</td>
<td class='edit'><a href='#'>Edit</a></td>
</tr>
<tr>
<td class='name pword' colspan='2'>Password</td>
<td class='edit'><a href='#'>Edit</a></td>
</tr>
<tr>
<td class='name remove-all' colspan='3'><a href='#'>Delete All Photos</a></td>
</tr>
<tr>
<td class='name remove-account' colspan='3'><a href='#'>Delete Account</a></td>
</tr>
</table>
<table class='change-name'>
<tr>
<td class='first'>First</td>
<td><input type='text' name='fname' class='fname'></td>
</tr>
<tr>
<td class='middle'>Middle</td>
<td><input type='text' name='mname' class='mname'></td>
</tr>
<tr>
<td class='last'>Last</td>
<td><input type='text' name='lname' class='lname'></td>
</tr>
<tr>
<td class='save'><a href='#'>Save</a></td>
<td class='cancel'><a href='#'>Cancel</a></td>
</tr>
</table>
</div>
<!-- end settings -->
CSS:
/* Settings */
.settings {
width: 650px;
margin: 0 auto;
padding: 1em;
}
.settings h4 {
padding: 1em 0;
letter-spacing: 1px;
border-bottom: 1px solid #cacece;
}
.settings table {
width: 100%;
font-size: 0.9em;
letter-spacing: 1px;
font-weight: 200;
table-layout: fixed;
}
.settings tr { border-bottom: 1px solid #cacece; }
.settings td { padding: 0.5em 0; }
.settings .edit { text-align: right; }
.settings .name { font-weight: bold; }
.settings .remove-all, .settings .remove-account { font-weight: 200; }
/* Change Name Table */
.change-name {
background: #cacece;
width: 300px;
}
.change-name tr { border: none; }
Result: https://jsfiddle.net/yy1mu2ze/
If I do the following:
table.change-name {
background: #cacece;
width: 300px;
}
I get: https://jsfiddle.net/yy1mu2ze/1/
Why is this?

Collapse an element when expand another element only css

I have asp.net site. By some reason, I can't use javascript in my code. I use this code for create a expansible table:
html, body, form {
margin: 0 auto;
padding: 0;
text-align: left;
height: 100%;
top: 0;
bottom: 0;
overflow: hidden;
}
tr:nth-child(even) {
background: #F5F5F5;
}
tr:nth-child(odd) {
background: #DCDCDC;
}
tr:hover
{
background-color: #D3D3D3;
}
.toggle-box {
display: none;
}
.toggle-box + label {
cursor: pointer;
display: block;
font-weight: bold;
line-height: 25px;
margin-bottom: 2px;
margin-left: 5px;
background-color: #F1F8FF;
border-bottom: 1px solid gray;
}
.toggle-box + label:hover {
background-color: #C5ECFF;
}
.toggle-box + label + div {
display: none;
margin-bottom: 10px;
margin-left: 20px;
}
.toggle-box:checked + label + div {
display: block;
}
.toggle-box + label:before {
background-color: #66AEFF;
-webkit-border-radius: 15px;
-moz-border-radius: 15px;
border-radius: 15px;
color: #FFFFFF;
content: "+";
display: block;
float: left;
font-weight: bold;
height: 25px;
line-height: 25px;
margin-right: 5px;
text-align: center;
width: 25px;
}
.toggle-box:checked + label:before {
content: "\2212";
}
#matru {
border: 0;
text-align: left;
position: absolute;
top: 100px;
left: 300px;
}
<div runat="server" id="sidebar" style="padding: 5px 0 0 5px;">
<input class='toggle-box' id='header1' type='checkbox' /><label for='header1'>Nguyễn Văn Tư</label><div>
<table style='text-align: left; width: 100%; vertical-align: middle;'>
<tr>
<td>Tên khách hàng</td>
<td>Nguyễn Văn Tư</td>
</tr>
<tr>
<td>Mã khách hàng</td>
<td>PC06LL0191387</td>
</tr>
<tr>
<td>Sery công tơ</td>
<td>14138734</td>
</tr>
<tr>
<td>Chỉ số cũ</td>
<td>194.000</td>
</tr>
<tr>
<td>Chỉ số mới</td>
<td>196.60</td>
</tr>
<tr>
<td>Sản lượng mới</td>
<td>2</td>
</tr>
</table>
</div>
<input class='toggle-box' id='header2' type='checkbox' /><label for='header2'>ĐInh Thị Tha</label><div>
<table style='text-align: left; width: 100%; vertical-align: middle;'>
<tr>
<td>Tên khách hàng</td>
<td>ĐInh Thị Tha</td>
</tr>
<tr>
<td>Mã khách hàng</td>
<td>PC06LL0182038</td>
</tr>
<tr>
<td>Sery công tơ</td>
<td>14140069</td>
</tr>
<tr>
<td>Chỉ số cũ</td>
<td>2050.000</td>
</tr>
<tr>
<td>Chỉ số mới</td>
<td>2104.10</td>
</tr>
<tr>
<td>Sản lượng mới</td>
<td>54</td>
</tr>
</table>
</div>
<input class='toggle-box' id='header3' type='checkbox' /><label for='header3'>Nguyễn Văn Nhựt</label><div>
<table style='text-align: left; width: 100%; vertical-align: middle;'>
<tr>
<td>Tên khách hàng</td>
<td>Nguyễn Văn Nhựt</td>
</tr>
<tr>
<td>Mã khách hàng</td>
<td>PC06LL0190775</td>
</tr>
<tr>
<td>Sery công tơ</td>
<td>14138746</td>
</tr>
<tr>
<td>Chỉ số cũ</td>
<td>2699.000</td>
</tr>
<tr>
<td>Chỉ số mới</td>
<td>2785.10</td>
</tr>
<tr>
<td>Sản lượng mới</td>
<td>86</td>
</tr>
</table>
</div>
<input class='toggle-box' id='header4' type='checkbox' /><label for='header4'>Mai Văn Lý</label><div>
<table style='text-align: left; width: 100%; vertical-align: middle;'>
<tr>
<td>Tên khách hàng</td>
<td>Mai Văn Lý</td>
</tr>
<tr>
<td>Mã khách hàng</td>
<td>PC06LL0182035</td>
</tr>
<tr>
<td>Sery công tơ</td>
<td>14138744</td>
</tr>
<tr>
<td>Chỉ số cũ</td>
<td>2581.000</td>
</tr>
<tr>
<td>Chỉ số mới</td>
<td>2631.70</td>
</tr>
<tr>
<td>Sản lượng mới</td>
<td>50</td>
</tr>
</table>
</div>
</div>
Full code here: https://jsfiddle.net/pdhung197/3eomjp3m/
But I want more: When I click on an collapsed element, that element will be expanded and other element will be collapsed.
This project can use only CSS, no JavaScript so I have no solution to do it.
The trick is simple. Just replace the input from checkbox to radio and add attribute name with same value in all of the inputs.
This changes mean that there is just one input that can be checked in the same time. So, if you click to one item all the rest will be closed.
html, body, form {
margin: 0 auto;
padding: 0;
text-align: left;
height: 100%;
top: 0;
bottom: 0;
overflow: hidden;
}
tr:nth-child(even) {
background: #F5F5F5;
}
tr:nth-child(odd) {
background: #DCDCDC;
}
tr:hover
{
background-color: #D3D3D3;
}
.toggle-box {
display: none;
}
[type="reset"] {
border: 0;
width: 100%;
text-align: inherit;
padding: 0;
font: inherit;
margin: 0;
outline:0 !important;
}
.toggle-box + label,
[type="reset"]{
cursor: pointer;
display: block;
font-weight: bold;
line-height: 25px;
margin-bottom: 2px;
margin-left: 5px;
background-color: #F1F8FF;
border-bottom: 1px solid gray;
}
.toggle-box + label:hover {
background-color: #C5ECFF;
}
.toggle-box + label + button {
display:none;
}
.toggle-box:checked + label {
display:none;
}
.toggle-box:checked + label + button {
display:block;
}
.toggle-box + label + button + div {
display: none;
margin-bottom: 10px;
margin-left: 20px;
}
.toggle-box:checked + label + button + div {
display: block;
}
.toggle-box + label:before,
[type="reset"]:before{
background-color: #66AEFF;
-webkit-border-radius: 15px;
-moz-border-radius: 15px;
border-radius: 15px;
color: #FFFFFF;
content: "+";
display: block;
float: left;
font-weight: bold;
height: 25px;
line-height: 25px;
margin-right: 5px;
text-align: center;
width: 25px;
}
.toggle-box:checked + label:before {
content: "\2212";
}
#matru {
border: 0;
text-align: left;
position: absolute;
top: 100px;
left: 300px;
}
<form>
<div runat="server" id="sidebar" style="padding: 5px 0 0 5px;">
<input class='toggle-box' id='header1' type="radio" name="radio" /><label for='header1'>Nguyễn Văn Tư</label>
<button type="reset">Nguyễn Văn Tư</button>
<div>
<table style='text-align: left; width: 100%; vertical-align: middle;'>
<tr>
<td>Tên khách hàng</td>
<td>Nguyễn Văn Tư</td>
</tr>
<tr>
<td>Mã khách hàng</td>
<td>PC06LL0191387</td>
</tr>
<tr>
<td>Sery công tơ</td>
<td>14138734</td>
</tr>
<tr>
<td>Chỉ số cũ</td>
<td>194.000</td>
</tr>
<tr>
<td>Chỉ số mới</td>
<td>196.60</td>
</tr>
<tr>
<td>Sản lượng mới</td>
<td>2</td>
</tr>
</table>
</div>
<input class='toggle-box' id='header2' type='radio' name="radio" /><label for='header2'>ĐInh Thị Tha</label>
<button type="reset">ĐInh Thị Tha</button>
<div>
<table style='text-align: left; width: 100%; vertical-align: middle;'>
<tr>
<td>Tên khách hàng</td>
<td>ĐInh Thị Tha</td>
</tr>
<tr>
<td>Mã khách hàng</td>
<td>PC06LL0182038</td>
</tr>
<tr>
<td>Sery công tơ</td>
<td>14140069</td>
</tr>
<tr>
<td>Chỉ số cũ</td>
<td>2050.000</td>
</tr>
<tr>
<td>Chỉ số mới</td>
<td>2104.10</td>
</tr>
<tr>
<td>Sản lượng mới</td>
<td>54</td>
</tr>
</table>
</div>
<input class='toggle-box' id='header3' type='radio' name="radio" /><label for='header3'>Nguyễn Văn Nhựt</label>
<button type="reset">Nguyễn Văn Nhựt</button>
<div>
<table style='text-align: left; width: 100%; vertical-align: middle;'>
<tr>
<td>Tên khách hàng</td>
<td>Nguyễn Văn Nhựt</td>
</tr>
<tr>
<td>Mã khách hàng</td>
<td>PC06LL0190775</td>
</tr>
<tr>
<td>Sery công tơ</td>
<td>14138746</td>
</tr>
<tr>
<td>Chỉ số cũ</td>
<td>2699.000</td>
</tr>
<tr>
<td>Chỉ số mới</td>
<td>2785.10</td>
</tr>
<tr>
<td>Sản lượng mới</td>
<td>86</td>
</tr>
</table>
</div>
<input class='toggle-box' id='header4' type='radio' name="radio" /><label for='header4'>Mai Văn Lý</label>
<button type="reset">Mai Văn Lý</button>
<div>
<table style='text-align: left; width: 100%; vertical-align: middle;'>
<tr>
<td>Tên khách hàng</td>
<td>Mai Văn Lý</td>
</tr>
<tr>
<td>Mã khách hàng</td>
<td>PC06LL0182035</td>
</tr>
<tr>
<td>Sery công tơ</td>
<td>14138744</td>
</tr>
<tr>
<td>Chỉ số cũ</td>
<td>2581.000</td>
</tr>
<tr>
<td>Chỉ số mới</td>
<td>2631.70</td>
</tr>
<tr>
<td>Sản lượng mới</td>
<td>50</td>
</tr>
</table>
</div>
</div>
</form>
http://jsbin.com/pefobi
Note: If you need that the second click will close the tab again, you have to wrap all with form tag.

Separator of different sizes

Is it possible to have separator of diferent sizes as the example below
PlunkerDemo
<tr class="foo">
<td>
<div>
<p>
<span class="departureTime">03h00</span>
<span>New-York</span>
</p>
<p class="espacement_important">
<span class="arrivalTime">15h00</span>
<span>Bahamas</span>
</p>
<p class="duration espacement_important"><span >8h00</span>
<span>2 correspond.</span>
<span>A380</span>
</p>
</div>
</td>
<td class="unavailable">indisponible</td>
<td><input type="radio" />
<label >10.00 €</label>
</td>
<td><input type="radio" />
<label >50.00 €</label>
</td>
</tr>
You can do this usign pseudo-elemnts:
First assign name classes to your td elements like long and short:
<td class="long">
<div>
<p>
<span class="departureTime">03h00</span>
<span>New-York</span>
</p>
<p class="espacement_important">
<span class="arrivalTime">15h00</span>
<span>Bahamas</span>
</p>
<p class="duration espacement_important"><span>8h00</span>
<span>2 correspond.</span>
<span>A380</span>
</p>
</div>
</td>
<td class="unavailable">indisponible</td>
<td class="short">
<input type="radio" />
<label>10.00 €</label>
</td>
Then use CSS like this:
.long {
position:relative;
}
.long:after {
content:" ";
height:80%;
border-right:1px solid #eee;
position:Absolute;
right:0;
top:10%;
}
.short {
position:relative;
}
.short:after, .short:before {
content:" ";
height:40%;
border-right:1px solid #eee;
position:Absolute;
right:0;
top:30%;
}
.short:before {
left:0;
right:auto;
}
PlunkerDemo
If you want to avoid the classnames you can use nth-child but only if suits your needs
See the method below and adjust as needed. Will work with a DIV also
table {
border: none;
border-collapse: #EEEEEE;
}
tr {
border: solid 1px #5E6977;
display: block;
margin-bottom: 10px;
min-height: 60px;
width: 500px;
padding: 5px;
}
tr.no-border {
border: none;
border-bottom: solid 1px #5E6977;
}
th {
line-height: 60px;
border: none;
width: 160px;
}
td {
border: none;
width: 160px;
height: 60px;
position: relative;
}
td:last-of-type {
border-right: none;
}
td:nth-of-type(1):after {
content:'';
border-right: solid 1px #5E6977;
position: relative;
width: 160px;
min-height: 30px;
display: table;
background: transparent;
top: 1%;
line-height: 60px;
}
td:nth-of-type(2):after {
content:'';
border-right: solid 1px #5E6977;
line-height: 60px;
position: absolute;
width: 160px;
min-height: 50px;
display: table;
background: transparent;
top: 10%;
}
<table width="200" border="1">
<tbody>
<tr class="no-border">
<th>Month</th>
<th>Savings</th>
<th>Savings</th>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
</tr>
</tbody>
</table>
support cross browser. simplicity new row.
...
<td>
<div style="width:1px;height:91px;background:green;"></div>
</td>
<td class="unavailable">indisponible</td>
<td>
<div style="width:1px;height:91px;background:green;"></div>
</td>
<td>
<input type="radio" />
<label >10.00 €</label>
</td>
...