I'm working on an app where I have a table with rows and columns and a container of checkboxes in the format of the image below :
The problem is that I want the letters A , B , C , D which represent each row to align on the same height with my checkboxes and by reducing margin or padding between the letters I see no difference so I need your help
My code :
.checkboxes-container{
position: absolute;
width:620px;
height:240px;
left:25%;
top:42%;
display:flex;
justify-content: flex-start;
}
.checkbox-container{
background-color:teal;
width:230px;
height:100%;
display:flex;
flex-flow:row wrap;
justify-content:flex-start;
}
.checkbox-container div{
flex-basis:100%;
}
.business-bx{
margin-top:17px;
transform:scale(1.5);
}
.business-bx:not(:first-child){
margin-left:38px;
}
.business-bx:first-child{
margin-left:10px;
}
.table tbody tr td:first-child {
font-weight:bold;
}
.table {
border-spacing: 3em;
}
.letter{
font-size:20px;
padding:0;
}
<div class="table-container">
<table class="table">
<thead>
<tr>
<td></td>
<td>1</td>
<td>2</td>
<td>3</td>
<td>4</td>
</tr>
</thead>
<tbody>
<tr class="letter">
<td>A</td>
</tr>
<tr class="letter">
<td>B</td>
</tr>
<tr class="letter">
<td>C</td>
</tr>
<tr class="letter">
<td>D</td>
</tr>
</tbody>
</table>
</div>
<div class="checkboxes-container">
<div class="checkbox-container business-boxes">
<div>
<input type="checkbox" class="business-bx">
<input type="checkbox" class="business-bx">
<input type="checkbox" class="business-bx">
<input type="checkbox" class="business-bx">
</div>
<div>
<input type="checkbox" class="business-bx">
<input type="checkbox" class="business-bx">
<input type="checkbox" class="business-bx">
<input type="checkbox" class="business-bx">
</div>
<div>
<input type="checkbox" class="business-bx">
<input type="checkbox" class="business-bx">
<input type="checkbox" class="business-bx">
<input type="checkbox" class="business-bx">
</div>
<div>
<input type="checkbox" class="business-bx">
<input type="checkbox" class="business-bx">
<input type="checkbox" class="business-bx">
<input type="checkbox" class="business-bx">
</div>
</div>
</div>
This can be achieved by merging you checkbox code with the table. Here, I have updated the code.
tbody>tr>td:not(:first-child) {
background-color: teal;
padding:20px;
}
tbody>tr>td{
padding-right:5px;
}
thead>tr>td{
text-align: center;
}
table{border-collapse: collapse;}
<div class="table-container">
<table class="table">
<thead>
<tr>
<td></td>
<td>1</td>
<td>2</td>
<td>3</td>
<td>4</td>
</tr>
</thead>
<tbody>
<tr class="letter">
<td>A</td>
<td><input type="checkbox" class="business-bx"></td>
<td><input type="checkbox" class="business-bx"></td>
<td><input type="checkbox" class="business-bx"></td>
<td><input type="checkbox" class="business-bx"></td>
</tr>
<tr class="letter">
<td>B</td>
<td><input type="checkbox" class="business-bx"></td>
<td><input type="checkbox" class="business-bx"></td>
<td><input type="checkbox" class="business-bx"></td>
<td><input type="checkbox" class="business-bx"></td>
</tr>
<tr class="letter">
<td>C</td>
<td><input type="checkbox" class="business-bx"></td>
<td><input type="checkbox" class="business-bx"></td>
<td><input type="checkbox" class="business-bx"></td>
<td><input type="checkbox" class="business-bx"></td>
</tr>
<tr class="letter">
<td>D</td>
<td><input type="checkbox" class="business-bx"></td>
<td><input type="checkbox" class="business-bx"></td>
<td><input type="checkbox" class="business-bx"></td>
<td><input type="checkbox" class="business-bx"></td>
</tr>
</tbody>
</table>
</div>
Related
I am trying to bring the entry fields closer to the names; it looks bit far. wanted to see if anybody can suggest. Html and css are shown below. This is how it looks now:
<div id="container">
<h3>Add Student</h3>
<form action="StudentControllerServlet" method="GET">
<input type="hidden" name="command" value="ADD" />
<table>
<tbody>
<tr>
<td><label>First name:</label></td>
<td> <input type="text" name="firstName"/></td>
</tr>
<tr>
<td><label>Last name:</label></td>
<td><input type="text" name="lastName"/></td>
</tr>
<tr>
<td><label>Email:</label></td>
<td> <input type="text" name="email" /></td>
</tr>
</tbody>
</table>
</form>
</div>
/* To mimic your screenshot */
#container table {
width: 50%;
outline: red 1px dotted;
}
/* To align your text closer */
#container table td:first-child {
outline: green 1px dashed;
text-align: right;
}
<div id="container">
<h3>Add Student</h3>
<form action="StudentControllerServlet" method="GET">
<input type="hidden" name="command" value="ADD" />
<table>
<tbody>
<tr>
<td><label>First name:</label></td>
<td> <input type="text" name="firstName"/></td>
</tr>
<tr>
<td><label>Last name:</label></td>
<td><input type="text" name="lastName"/></td>
</tr>
<tr>
<td><label>Email:</label></td>
<td> <input type="text" name="email" /></td>
</tr>
</tbody>
</table>
</form>
</div>
I have deleted my previous question as it was misleading in what I thought the issue was versus what I now think. I am having issues with blank space during vertical scrolling in mobile viewing. I have tried a handful of things, including messing with the viewport and the css and the only thing that seems to help is removing rows from the table to get it under a certain size. I'm sure there is some way around this, but I just haven't been able to figure it out. It doesn't appear to be an issue with the width of the table, I have tried several things to change that and nothing helped. It seems to be a forced page break due to the length of the form vertically. Here is the HTML:
<!DOCTYPE html>
<html>
<head><meta name="viewport" content="height=device height, width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no"/></head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script src="https://cdn.rawgit.com/willowsystems/jSignature/master/libs/jSignature.min.js"></script>
<style>
body {
font-family: Arial;
background-color: MidnightBlue;
color: GhostWhite;
display: inline-block;
}
.modal {
width: 100%;
height: 100%;
border: 2px solid #ccc;
border-radius: 4px;
background-color: GhostWhite;
color: Black;
}
input[type=text], select {
width: 100%;
height: 100px;
padding: 12px 20px;
margin: 8px 0;
display: block;
border: 1px solid #ccc;
border-radius: 4px;
box-sizing: border-box;
font-size: 2em;
}
input[type=number], select {
width: 100%;
height: 100px;
padding: 12px 20px;
margin: 8px 0;
display: block;
border: 1px solid #ccc;
border-radius: 4px;
box-sizing: border-box;
font-size: 2em;
}
input[type=date], select {
width: 100%;
height: 100px;
padding: 12px 20px;
margin: 8px 0;
display: block;
border: 1px solid #ccc;
border-radius: 4px;
box-sizing: border-box;
font-size: 2em;
}
input[type=time], select {
width: 100%;
height: 100px;
padding: 12px 20px;
margin: 8px 0;
display: block;
border: 1px solid #ccc;
border-radius: 4px;
box-sizing: border-box;
font-size: 2em;
}
input[type=submit] {
width: 100%;
background-color: DarkRed;
color: white;
padding: 14px 20px;
margin: 8px 0;
border: none;
border-radius: 4px;
cursor: pointer;
font-size: 1em;
}
input[type=radio] {
width: 50px;
height: 50px;
}
input[type=button] {
width: 150px;
height: 50px;
font-size: 30px;
display: block;
margin-left: auto;
}
#Address th, #Address td {
border: 2px solid #ddd;
font-size: 60px;
font-weight: bold;
width: 20%;
text-align: center;
}
#Inspection {
table-layout: auto;
height: 100%;
}
#Inspection th, #Inspection td {
border: 2px solid #ddd;
}
#Inspection th {
font-size: 30px;
text-align: left;
}
#Inspection td {
font-size: 15px;
text-align: center;
}
#customerForm {
font-size: 2em;
font-weight: Bold;
}
::placeholder {
font-size: 1em;
}
</style>
<body>
<center><h1><big><big>DRIVER VEHICLE INSPECTION REPORT</big></big></h1>
<h5>AS REQUIRED BY THE D.O.T. FEDERAL MOTOR CARRIER SAFETY REGULATIONS</h5></center><br>
<form id="customerForm" action="/action_page.php">
<div class="container">
<label for="carrier">Carrier:</label>
<select id="carrier" name="carrier" required>
<option value="My Company">My Company</option>
</select><br>
<table id="Address" width="100%">
<tr>Select Your Terminal Location:</tr>
<tr>
<th>PDX</th>
<th>EUG</th>
<th>SEA</th>
<th>SFO</th>
</tr>
<tr>
<td><input type="radio" id="PDX" name="Address" value="PDX"required></td>
<td><input type="radio" id="EUG" name="Address" value="EUG"required></td>
<td><input type="radio" id="SEA" name="Address" value="SEA"required></td>
<td><input type="radio" id="SFO" name="Address" value="SFO"required></td>
</tr>
</table><br>
<label for="Driver name">Driver Performing Inspection:</label>
<input type="text" id="dname" name="drivername" placeholder="Your full name" required><br>
<label for="Driver Employee ID number">Driver's Employee Number:</label><br>
<input type="number" id="dnum" name="drivernumber" placeholder="Your employee number" required><br><br>
<label for="Date">Date Performed:</label><br>
<input type="date" id="date" name="date" required><br><br>
<label for="Time">Time Performed:</label><br>
<input type="time" id="time" name="time" value="now" required><br><br>
<label for="Tractor/Truck#">Tractor / Truck #:</label><br>
<input type="number" id="tractor/truck" name="tractor/truck" placeholder="Your vehicle number" required><br><br>
<label for="Odometer">Odometer Reading:</label><br>
<input type="number" id="odom" name="odometer reading" placeholder="Vehicle odometer reading" required><br><br>
<center><h3>Tractor / Truck Inspection:</h3></center>
<table id="Inspection" width="100%">
<tr>
<th> </th>
<th>Satisfactory</th>
<th>Unsatisfactory</th>
</tr>
<tr>
<th><label for="Air Compressor">Air Compressor</label></th>
<td><input type="radio" id="air compressor" name="AirCompressor" value="Sat" required></td>
<td><input type="radio" id="air compressor2" name="AirCompressor" value="Unsat" required></td>
</tr>
<tr>
<th><label for="Air Lines">Air Lines</label></th>
<td><input type="radio" id="air lines" name="AirLines" value="Sat" required></td>
<td><input type="radio" id="air lines2" name="AirLines" value="Unsat" required></td>
</tr>
<tr>
<th><label for="Battery">Battery</label></th>
<td><input type="radio" id="Battery" name="Battery" value="Sat" required></td>
<td><input type="radio" id="Battery2" name="Battery" value="Unsat" required></td>
</tr>
<tr>
<th><label for="Belts and Hoses">Belts and Hoses</label></th>
<td><input type="radio" id="Belts and Hoses" name="BeltsandHoses" value="Sat" required></td>
<td><input type="radio" id="Belts and Hoses2" name="BeltsandHoses" value="Unsat"required></td>
</tr>
<tr>
<th><label for="Body">Body</label></th>
<td><input type="radio" id="Body" name="Body" value="Sat"required></td>
<td><input type="radio" id="Body2" name="Body" value="Unsat"required></td>
</tr>
<tr>
<th><label for="Brake Accessories">Brake Accessories</label></th>
<td><input type="radio" id="Brake Accessories" name="BrakeAccessories" value="Sat"required></td>
<td><input type="radio" id="Brake Accessories2" name="BrakeAccessories" value="Unsat"required></td>
</tr>
<tr>
<th><label for="Brakes, Parking">Brakes, Parking</label></th>
<td><input type="radio" id="Brakes, Parking" name="BrakesParking" value="Sat"required></td>
<td><input type="radio" id="Brakes, Parking2" name="BrakesParking" value="Unsat"required></td>
</tr>
<tr>
<th><label for="Brakes, Service">Brakes, Service</label></th>
<td><input type="radio" id="Brakes, Service" name="BrakesService" value="Sat"required></td>
<td><input type="radio" id="Brakes, Service2" name="BrakesService" value="Unsat"required></td>
</tr>
<tr>
<th><label for="Clutch">Clutch</label></th>
<td><input type="radio" id="Clutch" name="Clutch" value="Sat"required></td>
<td><input type="radio" id="Clutch2" name="Clutch" value="Unsat"required></td>
</tr>
<tr>
<th><label for="Coupling Devices">Coupling Devices</label></th>
<td><input type="radio" id="Coupling Devices" name="CouplingDevices" value="Sat"required></td>
<td><input type="radio" id="Coupling Devices2" name="CouplingDevices" value="Unsat"required></td>
</tr>
<tr>
<th><label for="Defroster/Heater">Defroster/Heater</label></th>
<td><input type="radio" id="Defroster/Heater" name="DefrosterHeater" value="Sat"required></td>
<td><input type="radio" id="Defroster/Heater2" name="DefrosterHeater" value="Unsat"required></td>
</tr>
<tr>
<th><label for="Drive Line">Drive Line</label></th>
<td><input type="radio" id="Drive Line" name="DriveLine" value="Sat"required></td>
<td><input type="radio" id="Drive Line2" name="DriveLine" value="Unsat"required></td>
</tr>
<tr>
<th><label for="Engine">Engine</label></th>
<td><input type="radio" id="Engine" name="Engine" value="Sat"required></td>
<td><input type="radio" id="Engine2" name="Engine" value="Unsat"required></td>
</tr>
<tr>
<th><label for="Exhaust">Exhaust</label></th>
<td><input type="radio" id="Exhaust" name="Exhaust" value="Sat"required></td>
<td><input type="radio" id="Exhaust2" name="Exhaust" value="Unsat"required></td>
</tr>
<tr>
<th><label for="Fifth Wheel">Fifth Wheel</label></th>
<td><input type="radio" id="Fifth Wheel" name="FifthWheel" value="Sat"required></td>
<td><input type="radio" id="Fifth Wheel2" name="FifthWheel" value="Unsat"required></td>
</tr>
<tr>
<th><label for="Fluid Levels">Fluid Levels</label></th>
<td><input type="radio" id="Fluid Levels" name="FluidLevels" value="Sat"required></td>
<td><input type="radio" id="Fluid Levels2" name="FluidLevels" value="Unsat"required></td>
</tr>
<tr>
<th><label for="Frame and Assembly">Frame and Assembly</label></th>
<td><input type="radio" id="Frame and Assembly" name="FrameandAssembly" value="Sat"required></td>
<td><input type="radio" id="Frame and Assembly2" name="FrameandAssembly" value="Unsat"required></td>
</tr>
<tr>
<th><label for="Front Axle">Front Axle</label></th>
<td><input type="radio" id="Front Axle" name="FrontAxle" value="Sat"required></td>
<td><input type="radio" id="Front Axle2" name="FrontAxle" value="Unsat"required></td>
</tr>
<tr>
<th><label for="Fuel Tanks">Fuel Tanks</label></th>
<td><input type="radio" id="Fuel Tanks" name="FuelTanks" value="Sat"required></td>
<td><input type="radio" id="Fuel Tanks2" name="FuelTanks" value="Unsat"required></td>
</tr>
<tr>
<th><label for="Horn">Horn</label></th>
<td><input type="radio" id="Horn" name="Horn" value="Sat"required></td>
<td><input type="radio" id="Horn2" name="Horn" value="Unsat"required></td>
</tr>
<tr>
<th><label for="Lights">Lights -<br> Head/Stop<br> Tail/Dash<br> Turn Indicators<br> Clearance/Marker</label></th>
<td><input type="radio" id="Lights" name="Lights" value="Sat"required></td>
<td><input type="radio" id="Lights2" name="Lights" value="Unsat"required></td>
</tr>
<tr>
<th><label for="Mirrors">Mirrors</label></th>
<td><input type="radio" id="Mirrors" name="Mirrors" value="Sat"required></td>
<td><input type="radio" id="Mirrors2" name="Mirrors" value="Unsat"required></td>
</tr>
<tr>
<th><label for="Muffler">Muffler</label></th>
<td><input type="radio" id="Muffler" name="Muffler" value="Sat"required></td>
<td><input type="radio" id="Muffler2" name="Muffler" value="Unsat"required></td>
</tr>
<tr>
<th><label for="Oil Pressure">Oil Pressure</label></th>
<td><input type="radio" id="Oil Pressure" name="OilPressure" value="Sat"required></td>
<td><input type="radio" id="Oil Pressure2" name="OilPressure" value="Unsat"required></td>
</tr>
<tr>
<th><label for="Radiator">Radiator</label></th>
<td><input type="radio" id="Radiator" name="Radiator" value="Sat"required></td>
<td><input type="radio" id="Radiator2" name="Radiator" value="Unsat"required></td>
</tr>
<tr>
<th><label for="Rear End">Rear End</label></th>
<td><input type="radio" id="Rear End" name="RearEnd" value="Sat"required></td>
<td><input type="radio" id="Rear End2" name="RearEnd" value="Unsat"required></td>
</tr>
<tr>
<th><label for="Reflectors">Reflectors</label></th>
<td><input type="radio" id="Reflectors" name="Reflectors" value="Sat"required></td>
<td><input type="radio" id="Reflectors2" name="Reflectors" value="Unsat"required></td>
</tr>
<tr>
<th><label for="Safety Equipment">Safety Equipment -<br> Fire Extinguisher<br> Flags/Flares/Fusees<br> Reflective Triangles<br> Spare Bulbs and Fuses<br> Spare Seal Beam</label></th>
<td><input type="radio" id="Safety Equipment" name="SafetyEquipment" value="Sat"required></td>
<td><input type="radio" id="Safety Equipment2" name="SafetyEquipment" value="Unsat"required></td>
</tr>
<tr>
<th><label for="Starter">Starter</label></th>
<td><input type="radio" id="Starter" name="Starter" value="Sat"required></td>
<td><input type="radio" id="Starter2" name="Starter" value="Unsat"required></td>
</tr>
<tr>
<th><label for="Steering">Steering</label></th>
<td><input type="radio" id="Steering" name="Steering" value="Sat"required></td>
<td><input type="radio" id="Steering2" name="Steering" value="Unsat"required></td>
</tr>
<tr>
<th><label for="Suspension System">Suspension System</label></th>
<td><input type="radio" id="Suspension System" name="SuspensionSystem" value="Sat"required></td>
<td><input type="radio" id="Suspension System2" name="SuspensionSystem" value="Unsat"required></td>
</tr>
<tr>
<th><label for="Tire Chains">Tire Chains</label></th>
<td><input type="radio" id="Tire Chains" name="TireChains" value="Sat"required></td>
<td><input type="radio" id="Tire Chains2" name="TireChains" value="Unsat"required></td>
</tr>
<tr>
<th><label for="Tires">Tires</label></th>
<td><input type="radio" id="Tires" name="Tires" value="Sat"required></td>
<td><input type="radio" id="Tires2" name="Tires" value="Unsat"required></td>
</tr>
<tr>
<th><label for="Transmission">Transmission</label></th>
<td><input type="radio" id="Transmission" name="Transmission" value="Sat"required></td>
<td><input type="radio" id="Transmission2" name="Transmission" value="Unsat"required></td>
</tr>
<tr>
<th><label for="Trip Recorder">Trip Recorder</label></th>
<td><input type="radio" id="Trip Recorder" name="TripRecorder" value="Sat"required></td>
<td><input type="radio" id="Trip Recorder2" name="TripRecorder" value="Unsat"required></td>
</tr>
<tr>
<th><label for="Wheels and Rims">Wheels and Rims</label></th>
<td><input type="radio" id="Wheels and Rims" name="WheelsandRims" value="Sat"required></td>
<td><input type="radio" id="Wheels and Rims2" name="WheelsandRims" value="Unsat"required></td>
</tr>
<tr>
<th><label for="Windows">Windows</label></th>
<td><input type="radio" id="Windows" name="Windows" value="Sat"required></td>
<td><input type="radio" id="Windows2" name="Windows" value="Unsat"required></td>
</tr>
<tr>
<th><label for="Windshield Wipers">Windshield Wipers</label></th>
<td><input type="radio" id="Windshield Wipers" name="WindshieldWipers" value="Sat"required></td>
<td><input type="radio" id="Windshield Wipers2" name="WindshieldWipers" value="Unsat"required></td>
</tr>
<tr>
<th><label for="Other">Other</label></th>
<td><input type="radio" id="Other" name="Other" value="Sat"required></td>
<td><input type="radio" id="Other2" name="Other" value="Unsat"required></td>
</tr>
</table><br>
<label for="modal-heading">Sign in the box below:</label>
<div class="modal">
<div class="signature-panel"></div>
<div class="controls-panel">
<input type="button" class="btn btn--secondary clear-button" value="Clear"/>
</div>
</div>
<img id="rendered" src="" style="display:none">
<input type="Submit" class="Submit" value="Submit and close" onclick="renderSignature();saveImage();"/>
</div>
</form>
</body>
<script>
$('.signature-panel').jSignature();
$('.clear-button').on('click', function(e) {
e.preventDefault();
$('.signature-panel').jSignature("reset");
});
</script>
</html>
Here is a link to a video showing the issue I am having with this:
https://www.youtube.com/watch?v=h0OIJy_HgCQ&feature=youtu.be
And a link to the code:
https://www.w3schools.com/code/tryit.asp?filename=G8B90OFNIKOC
I need to maintain the form in its appearance while removing the white space. Please help!
I have a number of labels and their textfields and their corresponding checkbox like below.
I want to align them in the center and proper spacing between them.
Here's the fiddle where I am trying.
For my screen at the moment, there's no distance between the text fields.
<div class="col-sm-4">
<table>
<tbody><tr>
<td><label for="">Design number</label></td>
<td><input type="text" name="Design number" value="SK123"></td>
</tr>
<tr>
<td><label for="">Price</label></td>
<td><input type="text" name="Price" value="500"><br><br></td>
</tr>
<tr>
<td><label for="">Never Out Of Stock</label></td>
<td><label><input type="checkbox" value=""><br><br></label></td>
</tr>
<tr>
<td><label for="">Pattern</label></td>
<td>
<label> <input type="checkbox" value="">Stripes<br></label>
<label><input type="checkbox" value="">Checks<br></label>
<label><input type="checkbox" value="">Prints<br></label>
<label><input type="checkbox" value="">Solid<br></label>
</td>
</tr>
<tr>
<td><label for="">Color</label></td>
<td>
<br><br>
<label><input type="checkbox" value="">White<br></label>
<label><input type="checkbox" value="">Blue<br></label>
<label><input type="checkbox" value="">Green<br></label>
<label><input type="checkbox" value="">Red<br></label>
<label><input type="checkbox" value="">Yellow<br></label>
</td>
</tr>
<tr>
<td><label for="">Occasion</label></td>
<td>
<br><br>
<label><input type="checkbox" value="">Casual<br></label>
<label><input type="checkbox" value="">Fancy<br></label>
<label><input type="checkbox" value="">Office<br></label>
</td>
</tr>
<tr>
<td><label for="">Fabric</label></td>
<td>
<br><br>
<label><input type="checkbox" value="">Silk<br></label>
<label><input type="checkbox" value="">Denim<br></label>
<label><input type="checkbox" value="">Velvet<br></label>
</td>
</tr>
</tbody>
</table>
</div>
Here a good (I hope) format of your code:
table {
width:800px;
}
table td {
width:70%;
padding-bottom: 5px;
padding-top: 5px;
border-bottom:solid 1px #dddddd;
/* text-align: center; <---- If you want all aligned to the center. */
}
table td:first-child {
width:30%;
}
label {
min-width:75px;
margin-left:10px;
}
input[type="checkbox"] {
margin-right:5px;
}
I have removed the "br" tag and add spaces.
The JSFiddle
<div class="col-sm-4">
<table>
<tbody>
<tr>
<td><label for="">Design number</label></td>
<td><input type="text" name="Design number" value="SK123"></td>
</tr>
<tr>
<td><label for="">Price</label></td>
<td><input type="text" name="Price" value="500"></td>
</tr>
<tr>
<td><label for="">Never Out Of Stock</label></td>
<td><input type="checkbox" value=""></td>
</tr>
<tr>
<td><label for="">Pattern</label></td>
<td>
<label><input type="checkbox" value="">Stripes</label>
<label><input type="checkbox" value="">Checks</label>
<label><input type="checkbox" value="">Prints<br></label>
<label><input type="checkbox" value="">Solid<br></label>
</td>
</tr>
<tr>
<td><label for="">Color</label></td>
<td>
<label><input type="checkbox" value="">White<br></label>
<label><input type="checkbox" value="">Blue<br></label>
<label><input type="checkbox" value="">Green<br></label>
<label><input type="checkbox" value="">Red<br></label>
<label><input type="checkbox" value="">Yellow<br></label>
</td>
</tr>
<tr>
<td><label for="">Occasion</label></td>
<td>
<label><input type="checkbox" value="">Casual<br></label>
<label><input type="checkbox" value="">Fancy<br></label>
<label><input type="checkbox" value="">Office<br></label>
</td>
</tr>
<tr>
<td><label for="">Fabric</label></td>
<td>
<label><input type="checkbox" value="">Silk<br></label>
<label><input type="checkbox" value="">Denim<br></label>
<label><input type="checkbox" value="">Velvet<br></label>
</td>
</tr>
</tbody>
</table>
</div>
Look fiddle : https://jsfiddle.net/4xrfw842/1/
Edit your html code
<div class="col-sm-4">
<table>
<tbody><tr>
<td><label for="">Design number</label></td>
<td><input type="text" value="SK123" name="Design number"></td>
</tr>
<tr>
<td><label for="">Price</label></td>
<td><input type="text" value="500" name="Price"><br><br></td>
</tr>
<tr>
<td><label for="">Never Out Of Stock</label></td>
<td><label><input type="checkbox" value=""></label></td>
</tr>
<tr>
<td><label for="">Pattern</label></td>
<td>
<label> <input type="checkbox" value="">Stripes<br></label>
<label><input type="checkbox" value="">Checks<br></label>
<label><input type="checkbox" value="">Prints<br></label>
<label><input type="checkbox" value="">Solid<br></label>
</td>
</tr>
<tr>
<td><label for="">Color</label></td>
<td>
<label><input type="checkbox" value="">White<br></label>
<label><input type="checkbox" value="">Blue<br></label>
<label><input type="checkbox" value="">Green<br></label>
<label><input type="checkbox" value="">Red<br></label>
<label><input type="checkbox" value="">Yellow<br></label>
</td>
</tr>
<tr>
<td><label for="">Occasion</label></td>
<td>
<label><input type="checkbox" value="">Casual<br></label>
<label><input type="checkbox" value="">Fancy<br></label>
<label><input type="checkbox" value="">Office<br></label>
</td>
</tr>
<tr>
<td><label for="">Fabric</label></td>
<td>
<label><input type="checkbox" value="">Silk<br></label>
<label><input type="checkbox" value="">Denim<br></label>
<label><input type="checkbox" value="">Velvet<br></label>
</td>
</tr>
</tbody></table>
</div>
https://jsfiddle.net/4xrfw842/5/
I'm trying to get a scroll working on my page. When I add overflow-y: scroll. it makes the content inside the div section completely disappear.
The CSS I currently have in for the div section is: overflow-y: scroll, height: 100%. Am I missing something?
<div id = "section">
<div id = "map">
<h1 align = "center">Find Us!</h1>
<div id = "map-canvas"></div>
<p>
</p>
</div>
<div id = "form">
<form method="post" action="mailto: jbloggs#ait.ie">
<fieldset>
<h1 align="center">Contact Us</h1>
<table class="contacttable">
<tr align="left" valign="middle">
<td>First Name</td>
<td><input type="text" name="firstname"/></td>
</tr>
<tr align="left" valign="middle">
<td>Surname</td>
<td><input type="text" name="lastname"/></td>
</tr>
<tr>
<td>Address Line 1</td>
<td><input type="text" name="addressline1"/></td>
</tr>
<tr>
<td>Address Line 2</td>
<td><input type="text" name="addressline2"/></td>
</tr>
<tr>
<td>Town</td>
<td><input type="text" name="town"/></td>
</tr>
<tr>
<td>County</td>
<td><input type="text" name="county"/></td>
</tr>
<tr align="left" valign="middle">
<td><input type="radio" name="sex" value="male"/>Male</td>
<td><input type="radio" name="sex" value="female"/>Female</td>
</tr>
<tr>
<td>Date of Birth</td>
<td><input type="text" name="dob"/></td>
</tr>
</table>
</fieldset>
</form>
</div>
</div>
#section {
max-height: 150px; /*add height as you want*/
overflow-y: auto;
}
Go through this http://www.w3schools.com/cssref/pr_pos_overflow.asp
Is there a way to set vertical scrollbar for a div?
This might helps you :)
I have a 4x4 table of radiobuttons. In the first row (an extra row ABOVE the 4x4) I would like a button centered horizontally. I have tried colspan etc. but all still leave the radiobutton in a column like the others, and thus uncentered.
Obligatory Table-less Answer:
<div>
<div class="center"><input type='button' value='hello' /></div>
<ul class="radioList">
<li>
<label for="radio1">
<input type="radio" id="radio1" />
Checkbox 1</label>
</li>
<li>
<label for="radio2">
<input type="radio" id="radio2" />
Checkbox 2</label>
</li>
<li>
<label for="radio3">
<input type="radio" id="radio3" />
Checkbox 3</label>
</li>
<li>
<label for="radio4">
<input type="radio" id="radio4" />
Checkbox 4</label>
</li>
</ul>
</div>
.center { text-align:center; }
.radioList {
list-style:none;
width:100%;
}
.radioList li {
float:left;
width:25%;
}
http://jsfiddle.net/Amudt/
http://jsfiddle.net/EJbny/
<table style='width:100%;' border=1>
<tr>
<td colspan=4 style='text-align:center;'><input type='button' value='hello'></td>
Like this? Just use CSS and the text-align:center rule on the top row. Here's a jsFiddle example.
<table>
<tr>
<td colspan="4" style="text-align:center"><input type="radio" /></td>
</tr>
<tr>
<td><input type="radio" /></td>
<td><input type="radio" /></td>
<td><input type="radio" /></td>
<td><input type="radio" /></td>
</tr>
<tr>
<td><input type="radio" /></td>
<td><input type="radio" /></td>
<td><input type="radio" /></td>
<td><input type="radio" /></td>
</tr>
<tr>
<td><input type="radio" /></td>
<td><input type="radio" /></td>
<td><input type="radio" /></td>
<td><input type="radio" /></td>
</tr>
<tr>
<td><input type="radio" /></td>
<td><input type="radio" /></td>
<td><input type="radio" /></td>
<td><input type="radio" /></td>
</tr>
</table>