(CSS only) Display section when wrapped input is checked - css

my overall goal is to have different inputs inline which when clicked show a section. I try to rely solely on CSS in this case. Until now it worked quite good; however since the input is wrapped into several other divs the section remains not displayed even when input is checked.
I tried different approaches in CSS to overcome the wrappers around the input... none were successful.
main {
min-width: 320px;
max-width: 100%;
height: auto;
padding: 20px;
margin: 0 auto;
}
section {
display: none;
padding: 20px 0 0;
border-top: 1px solid #f3f3f3;
}
#tab1,
#tab2,
#tab3,
#tab4 {
display: none;
}
.profile_overview {
margin-top: 2%;
width: 100%;
height: 40vh;
display: flex;
justify-content: space-between;
}
.profile_one,
.profile_two,
.profile_three,
.profile_four {
width: 22.5%;
height: 100%;
border-radius: 8px;
background-color: white;
box-shadow: 0 0 6px 0 rgba(0, 0, 0, 0.2);
}
.labeltab {
padding: 15px 25px;
font-weight: 600;
text-align: center;
color: #bbb;
border: 1px solid transparent;
}
.labeltab:before {
font-weight: lighter;
margin-right: 10px;
}
.labeltab:hover {
color: white;
cursor: pointer;
}
input:checked + .labeltab {
color: white;
border: 1px solid #f3f3f3;
}
#tab1:checked ~ #content1,
#tab2:checked ~ #content2,
#tab3:checked ~ #content3,
#tab4:checked ~ #content4 {
display: block;
}
<main>
<div class="profile_overview">
<div class="profile_one">
<input id="tab1" type="radio" name="tabs" value="a" />
<label class="labeltab" for="tab1">A</label>
</div>
<div class="profile_two">
<input id="tab2" type="radio" name="tabs" value="b" />
<label class="labeltab" for="tab2">B</label>
</div>
<div class="profile_three">
<input id="tab3" type="radio" name="tabs" value="c" />
<label class="labeltab" for="tab3">C</label>
</div>
<div class="profile_four">
<input id="tab4" type="radio" name="tabs" value="d" />
<label class="labeltab" for="tab4">D</label>
</div>
</div>
<section id="content1">
<p>1</p>
</section>
<section id="content2">
<p>2</p>
</section>
<section id="content3">
<p>3</p>
</section>
<section id="content4">
<p>4</p>
</section>
</main>

Since there is no parent's selector in CSS, your inputs have to be ahead in the code and sibblings for the closest position.
you have well linked your labels and inputs via the id and for attributes, you need to place your input as first children inside the parent container or just ahead where your content boxes are.
Your CSS selectors will then work fine.
main {
min-width: 320px;
max-width: 100%;
height: auto;
padding: 20px;
margin: 0 auto;
}
section {
display: none;
padding: 20px 0 0;
border-top: 1px solid #f3f3f3;
}
#tab1,
#tab2,
#tab3,
#tab4 {
display: none;
}
.profile_overview {
margin-top: 2%;
width: 100%;
height: 40vh;
display: flex;
justify-content: space-between;
}
.profile_one,
.profile_two,
.profile_three,
.profile_four {
width: 22.5%;
height: 100%;
border-radius: 8px;
background-color: white;
box-shadow: 0 0 6px 0 rgba(0, 0, 0, 0.2);
}
.labeltab {
padding: 15px 25px;
font-weight: 600;
text-align: center;
color: #bbb;
border: 1px solid transparent;
}
.labeltab:before {
font-weight: lighter;
margin-right: 10px;
}
.labeltab:hover {
color: white;
cursor: pointer;
}
input:checked+.labeltab {
color: white;
border: 1px solid #f3f3f3;
}
#tab1:checked~#content1,
#tab2:checked~#content2,
#tab3:checked~#content3,
#tab4:checked~#content4 {
display: block;
}
<main>
<!-- here is the HTML update structure to use the ::checked state to toggle display on next sibblings -->
<input id="tab1" type="radio" name="tabs" value="a" />
<input id="tab2" type="radio" name="tabs" value="b" />
<input id="tab3" type="radio" name="tabs" value="c" />
<input id="tab4" type="radio" name="tabs" value="d" />
<!-- end update -->
<div class="profile_overview">
<div class="profile_one">
<!-- input moved two level up in html tree -->
<label class="labeltab" for="tab1">A</label>
</div>
<div class="profile_two">
<!-- input moved two level up in html tree -->
<label class="labeltab" for="tab2">B</label>
</div>
<div class="profile_three">
<!-- input moved two level up in html tree -->
<label class="labeltab" for="tab3">C</label>
</div>
<div class="profile_four">
<!-- input moved two level up in html tree -->
<label class="labeltab" for="tab4">D</label>
</div>
</div>
<section id="content1">
<p>1</p>
</section>
<section id="content2">
<p>2</p>
</section>
<section id="content3">
<p>3</p>
</section>
<section id="content4">
<p>4</p>
</section>
</main>

Related

How to reduce excessive white space in fieldset/form-group

I've managed to convert my html form to have some fields side-by-side in a form-group to reduce the overall height of the form, but I can't get rid of the excessive white space to the right of the fields. Is the red box below coming from the container, the fieldset or the form-group? I am very new to html/Boostrap.
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="content-type" content="text/html;charset=utf-8" />
<meta name="robots" content="noindex,nofollow" />
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto" />
<link rel="icon" href="https://wonderfest.com/wp-content/uploads/2017/01/favicon.ico" type="image/x-icon"/>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<title>Search</title>
<style>
#outline {
position: relative;
height: auto;
width: auto;
/*margin: 18px auto 0;*/
margin: 10px 24px 0 24px;
border: 1px groove #ddd !important;
}
.logoimages {
width: auto;
height: auto;
position: absolute;
text-align: center;
top: 30px;
left: 15px;
}
img {
max-width: 100%;
height: auto;
width: auto\9; /* ie8 */
}
#title {
width: auto;
top: 90px;
position: absolute;
visibility: visible;
left: 0px;
}
#title .title-content {
font-family: 'Roboto', sans-serif;
font-weight: bolder;
font-size: 32px;
color: #e6bb57;
}
.line-bottom {
border-bottom: 5px solid #E6BB57;
width: 400px;
margin-left: auto;
margin-right: auto;
}
p {
color: #666;
font-size: 16px;
font-family: 'Roboto', sans-serif;
font-weight: normal;
margin-top: 5px;
}
h3 {
color: #666;
font-size: 60px;
font-family: 'Roboto', sans-serif;
font-weight: bold;
text-align: center;
letter-spacing: -1px;
width: auto;
}
h4 {
font-weight: bold;
font-family: 'Roboto', sans-serif;
text-align: center;
margin: 1.33em 0;
}
h5 {
font-weight: 500;
font-family: 'Roboto', sans-serif;
text-align: center;
margin: 1.33em 0;
}
a {
color: #666;
font-family: 'Roboto', sans-serif;
text-decoration: underline;
}
fieldset.scheduler-border {
border: 1px groove #ddd !important;
padding: 0 1.4em 1.4em 1.4em !important;
margin: 0 0 1.5em 0 !important;
-webkit-box-shadow: 0px 0px 0px 0px #000;
box-shadow: 0px 0px 0px 0px #000;
}
legend.scheduler-border {
font-family: 'Roboto', sans-serif;
font-size: 1.2em !important;
font-weight: bold !important;
text-align: left !important;
width:auto;
padding:0 10px;
border-bottom:none;
}
/* Start by setting display:none to make this hidden.
Then we position it in relation to the viewport window
with position:fixed. Width, height, top and left speak
for themselves. Background we set to 80% white with
our animation centered, and no-repeating */
.modalLoading {
display: none;
position: fixed;
z-index: 1000;
top: 0;
left: 0;
height: 100%;
width: 100%;
text-align: center;
background: rgba( 255, 255, 255, .8 )
/*url('http://i.stack.imgur.com/FhHRx.gif') */
url('<?php echo BASE_HDR_TAG . "contest/common/img/ajax-loader-red.gif"; ?>')
50% 50%
no-repeat;
}
/* When the body has the loading class, we turn
the scrollbar off with overflow:hidden */
body.loading .modalLoading {
overflow: hidden;
}
/* Anytime the body has the loading class, our
modal element will be visible */
body.loading .modalLoading {
display: block;
}
</style>
</head>
<body>
<noscript>
<style>
.pagecontainer {display:none;}
</style>
<div class="noscriptmsg">
<h4>JavaScript is disabled on your browser. You will not be able to use this application until it is enabled.</h4>
<h5>Please refer to your browser's specific configuration details to change this setting.</h5>
<p align="center">© <?php echo date('Y')?> USA, INC.</p>
<p align="center">Version <?php echo $pageVer?></p>
</div>
</noscript>
<div class="pagecontainer">
<div id="outline">
<div id="bckgrnd" style="text-align: center">
<img src="../common/img/background-1.jpg"/>
<div class="logoimages" style="text-align: center">
<img src="../common/img/combined_images.png" class="center-block img-responsive" id="top-img1" width="454" height="61" />
</div>
<div id="title" style="text-align: center">
<h3 class="title-content">Search</h3>
<div class="line-bottom"></div>
</div>
</div>
<div>
<p align="center">
<a href="javascript:window.location.href = '../common/php/logout.php';" class="btn btn-info btn-sm">
<span class="glyphicon glyphicon-log-out"></span> Log out
</a>
</p>
</div>
<div class="container" style="padding:10px 10px;">
<fieldset class="scheduler-border">
<legend class="scheduler-border">Search criteria</legend>
<form id="searchForm" name="searchForm" class="form-horizontal">
<div class="fields-search"> <!--for textfields -->
<div class="form-group">
<div class="col-sm-2">
<label for="barcode" class="sr-only"></label>
<input id="barcode" name="barcode" class="form-control input-group-lg" type="text" placeholder="Barcode" value="">
</div>
<div class="col-sm-5">
<label for="entry-number" class="sr-only"></label>
<input id="entry-number" name="entry-number" class="form-control input-group-lg" type="text" placeholder="Entry # (separate multiple entries with commas)" value="">
</div>
</div>
<div class="form-group">
<div class="col-sm-3">
<label for="first-name" class="sr-only"></label>
<input id="first-name" name="first-name" class="form-control input-group-lg" type="text" placeholder="First name" value="">
</div>
<div class="col-sm-4">
<label for="last-name" class="sr-only"></label>
<input id="last-name" name="last-name" class="form-control input-group-lg" type="text" placeholder="Last name" value="">
</div>
</div><!--/form-group-->
<div class="form-group">
<div class="col-sm-7">
<label for="title-name" class="sr-only"></label>
<input id="title-name" name="title-name" class="form-control input-group-lg" placeholder="Title or name of entry" value="">
</div>
</div>
</div>
</form>
</fieldset>
</div>
<br/>
<br/>
<div id="footer">
<p align="center">© <?php echo date('Y')?>USA, INC.</p>
<p align="center">Version <?php echo $pageVer?></p>
</div>
</div>
</div>
<div class="modalLoading"></div>
</body>
</html>
I believe my problem is different than How to remove or reduce the white space in bootstrap? as I tried the no-padding class and made no difference.
Changed col-sm-* classes in the form group elements. Also add ad row and col-sm-7 divs before fieldset div
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="content-type" content="text/html;charset=utf-8" />
<meta name="robots" content="noindex,nofollow" />
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto" />
<link rel="icon" href="https://wonderfest.com/wp-content/uploads/2017/01/favicon.ico" type="image/x-icon" />
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<title>Search</title>
<style>
#outline {
position: relative;
height: auto;
width: auto;
/*margin: 18px auto 0;*/
margin: 10px 24px 0 24px;
border: 1px groove #ddd !important;
}
.logoimages {
width: auto;
height: auto;
position: absolute;
text-align: center;
top: 30px;
left: 15px;
}
img {
max-width: 100%;
height: auto;
width: auto\9;
/* ie8 */
}
#title {
width: auto;
top: 90px;
position: absolute;
visibility: visible;
left: 0px;
}
#title .title-content {
font-family: 'Roboto', sans-serif;
font-weight: bolder;
font-size: 32px;
color: #e6bb57;
}
.line-bottom {
border-bottom: 5px solid #E6BB57;
width: 400px;
margin-left: auto;
margin-right: auto;
}
p {
color: #666;
font-size: 16px;
font-family: 'Roboto', sans-serif;
font-weight: normal;
margin-top: 5px;
}
h3 {
color: #666;
font-size: 60px;
font-family: 'Roboto', sans-serif;
font-weight: bold;
text-align: center;
letter-spacing: -1px;
width: auto;
}
h4 {
font-weight: bold;
font-family: 'Roboto', sans-serif;
text-align: center;
margin: 1.33em 0;
}
h5 {
font-weight: 500;
font-family: 'Roboto', sans-serif;
text-align: center;
margin: 1.33em 0;
}
a {
color: #666;
font-family: 'Roboto', sans-serif;
text-decoration: underline;
}
fieldset.scheduler-border {
border: 1px groove #ddd !important;
padding: 0 1.4em 1.4em 1.4em !important;
margin: 0 0 1.5em 0 !important;
-webkit-box-shadow: 0px 0px 0px 0px #000;
box-shadow: 0px 0px 0px 0px #000;
}
legend.scheduler-border {
font-family: 'Roboto', sans-serif;
font-size: 1.2em !important;
font-weight: bold !important;
text-align: left !important;
width: auto;
padding: 0 10px;
border-bottom: none;
}
/* Start by setting display:none to make this hidden.
Then we position it in relation to the viewport window
with position:fixed. Width, height, top and left speak
for themselves. Background we set to 80% white with
our animation centered, and no-repeating */
.modalLoading {
display: none;
position: fixed;
z-index: 1000;
top: 0;
left: 0;
height: 100%;
width: 100%;
text-align: center;
background: rgba( 255, 255, 255, .8)
/*url('http://i.stack.imgur.com/FhHRx.gif') */
url('<?php echo BASE_HDR_TAG . "contest/common/img/ajax-loader-red.gif"; ?>') 50% 50% no-repeat;
}
/* When the body has the loading class, we turn
the scrollbar off with overflow:hidden */
body.loading .modalLoading {
overflow: hidden;
}
/* Anytime the body has the loading class, our
modal element will be visible */
body.loading .modalLoading {
display: block;
}
</style>
</head>
<body>
<noscript>
<style>
.pagecontainer {display:none;}
</style>
<div class="noscriptmsg">
<h4>JavaScript is disabled on your browser. You will not be able to use this application until it is enabled.</h4>
<h5>Please refer to your browser's specific configuration details to change this setting.</h5>
<p align="center">© <?php echo date('Y')?> USA, INC.</p>
<p align="center">Version <?php echo $pageVer?></p>
</div>
</noscript>
<div class="pagecontainer">
<div id="outline">
<div id="bckgrnd" style="text-align: center">
<img src="../common/img/background-1.jpg" />
<div class="logoimages" style="text-align: center">
<img src="../common/img/combined_images.png" class="center-block img-responsive" id="top-img1" width="454" height="61" />
</div>
<div id="title" style="text-align: center">
<h3 class="title-content">Search</h3>
<div class="line-bottom"></div>
</div>
</div>
<div>
<p align="center">
<a href="javascript:window.location.href = '../common/php/logout.php';" class="btn btn-info btn-sm">
<span class="glyphicon glyphicon-log-out"></span> Log out
</a>
</p>
</div>
<div class="container" style="padding:10px 10px;">
<div class="row">
<div class="col-sm-7">
<fieldset class="scheduler-border">
<legend class="scheduler-border">Search criteria</legend>
<form id="searchForm" name="searchForm" class="form-horizontal">
<div class="fields-search">
<!--for textfields -->
<div class="form-group">
<div class="col-sm-4">
<label for="barcode" class="sr-only"></label>
<input id="barcode" name="barcode" class="form-control input-group-lg" type="text" placeholder="Barcode" value="">
</div>
<div class="col-sm-8">
<label for="entry-number" class="sr-only"></label>
<input id="entry-number" name="entry-number" class="form-control input-group-lg" type="text" placeholder="Entry # (separate multiple entries with commas)" value="">
</div>
</div>
<div class="form-group">
<div class="col-sm-6">
<label for="first-name" class="sr-only"></label>
<input id="first-name" name="first-name" class="form-control input-group-lg" type="text" placeholder="First name" value="">
</div>
<div class="col-sm-6">
<label for="last-name" class="sr-only"></label>
<input id="last-name" name="last-name" class="form-control input-group-lg" type="text" placeholder="Last name" value="">
</div>
</div>
<!--/form-group-->
<div class="form-group">
<div class="col-sm-12">
<label for="title-name" class="sr-only"></label>
<input id="title-name" name="title-name" class="form-control input-group-lg" placeholder="Title or name of entry" value="">
</div>
</div>
</div>
</form>
</fieldset>
</div>
</div>
</div>
<br/>
<br/>
<div id="footer">
<p align="center">©
<?php echo date('Y')?>USA, INC.</p>
<p align="center">Version
<?php echo $pageVer?>
</p>
</div>
</div>
</div>
<div class="modalLoading"></div>
</body>
</html>

Pure CSS Thumbnail viewer, but problems with placement

I have a pure CSS image script I use with my eBay listings, I'm changing the design of my template at the moment and have run into a major snag with the code, it seems that the large image can only be displayed directly below the thumbnail radio buttons, but I want to have the large image being displayed in a different table cell..
I don't know a great deal about CSS, so hopefully someone will know an easy fix? here's hoping..
<style type="text/css">
div.Image1BlockS { width:110px; height:92px; background-image:url('https://i1066.photobucket.com/albums/u409/magneato1/image1_zpsus8mlxre.jpg'); background-size: 110px 92px; }
div.Image2BlockS { width:110px; height:92px; background-image:url('https://i1066.photobucket.com/albums/u409/magneato1/image2_zpsetwycsgp.jpg'); background-size: 110px 92px; }
div.Image3BlockS { width:110px; height:92px; background-image:url('https://i1066.photobucket.com/albums/u409/magneato1/image3_zpsxtx5woeg.jpg'); background-size: 110px 92px; }
div.Image4BlockS { width:110px; height:92px; background-image:url('https://i1066.photobucket.com/albums/u409/magneato1/image4_zpsixuqksa5.jpg'); background-size: 110px 92px; }
div.Image5BlockS { width:110px; height:92px; background-image:url('https://i1066.photobucket.com/albums/u409/magneato1/image4_zpsixuqksa5.jpg'); background-size: 110px 92px; }
div.Image1BlockB { width:600px; height:500px; background-image:url('https://i1066.photobucket.com/albums/u409/magneato1/image1_zpsus8mlxre.jpg'); background-size: 600px 500px; }
div.Image2BlockB { width:600px; height:500px; background-image:url('https://i1066.photobucket.com/albums/u409/magneato1/image2_zpsetwycsgp.jpg'); background-size: 600px 500px; }
div.Image3BlockB { width:600px; height:500px; background-image:url('https://i1066.photobucket.com/albums/u409/magneato1/image3_zpsxtx5woeg.jpg'); background-size: 600px 500px; }
div.Image4BlockB { width:600px; height:500px; background-image:url('https://i1066.photobucket.com/albums/u409/magneato1/image4_zpsixuqksa5.jpg'); background-size: 600px 500px; }
div.Image5BlockB { width:600px; height:500px; background-image:url('https://i1066.photobucket.com/albums/u409/magneato1/image4_zpsixuqksa5.jpg'); background-size: 600px 500px; }
section {
display: none;
}
input {
display: none;
}
label {
display: inline-block;
font-weight: 600;
color: #bbb;
border: 1px solid transparent;
}
label:hover {
cursor: hand;
border: 1px solid #1F7AB6;
box-shadow: 2px 2px 7px #d0d0d0;
}
label {
margin: 0px 5px 0px 0px;
}
input:checked + label {
border: 1px solid #155179;
box-shadow: 2px 2px 7px #c0c0c0;
}
#tab1:checked ~ #content1,
#tab2:checked ~ #content2,
#tab3:checked ~ #content3,
#tab4:checked ~ #content4,
#tab5:checked ~ #content5 {
display: block;
}
</style>
<table border=1><tr><td>
<input id="tab1" type="radio" name="tabs" checked>
<label for="tab1"><div class="Image1BlockS"></div></label>
<input id="tab2" type="radio" name="tabs">
<label for="tab2"><div class="Image2BlockS"></div></label>
<input id="tab3" type="radio" name="tabs">
<label for="tab3"><div class="Image3BlockS"></div></label>
<input id="tab4" type="radio" name="tabs">
<label for="tab4"><div class="Image4BlockS"></div></label>
<input id="tab5" type="radio" name="tabs">
<label for="tab5"><div class="Image5BlockS"></div></label>
<section id="content1">
<div class="Image1BlockB"></div>
</section>
<section id="content2">
<div class="Image2BlockB"></div>
</section>
<section id="content3">
<div class="Image3BlockB"></div>
</section>
<section id="content4">
<div class="Image4BlockB"></div>
</section>
<section id="content5">
<div class="Image5BlockB"></div>
</section>
</td></tr></table>
I need to rewrite it so that I can put the large image anywhere
throughout the template and still be able to have the small thumbnails
change it when they're clicked.
Well if this is the case then you can experiment with the positioning.
On the other hand you can imitate the table behavior with display: table and td with display: table-cell to get you closer to the desired result.
* {margin:0;padding:0;box-sizing:border-box}
html, body {width:100%}
div.Image1BlockS { width:110px; height:92px; background-image:url('https://i1066.photobucket.com/albums/u409/magneato1/image1_zpsus8mlxre.jpg'); background-size: 110px 92px; }
div.Image2BlockS { width:110px; height:92px; background-image:url('https://i1066.photobucket.com/albums/u409/magneato1/image2_zpsetwycsgp.jpg'); background-size: 110px 92px; }
div.Image3BlockS { width:110px; height:92px; background-image:url('https://i1066.photobucket.com/albums/u409/magneato1/image3_zpsxtx5woeg.jpg'); background-size: 110px 92px; }
div.Image4BlockS { width:110px; height:92px; background-image:url('https://i1066.photobucket.com/albums/u409/magneato1/image4_zpsixuqksa5.jpg'); background-size: 110px 92px; }
div.Image5BlockS { width:110px; height:92px; background-image:url('https://i1066.photobucket.com/albums/u409/magneato1/image4_zpsixuqksa5.jpg'); background-size: 110px 92px; }
div.Image1BlockB { width:600px; height:500px; background-image:url('https://i1066.photobucket.com/albums/u409/magneato1/image1_zpsus8mlxre.jpg'); background-size: 600px 500px; }
div.Image2BlockB { width:600px; height:500px; background-image:url('https://i1066.photobucket.com/albums/u409/magneato1/image2_zpsetwycsgp.jpg'); background-size: 600px 500px; }
div.Image3BlockB { width:600px; height:500px; background-image:url('https://i1066.photobucket.com/albums/u409/magneato1/image3_zpsxtx5woeg.jpg'); background-size: 600px 500px; }
div.Image4BlockB { width:600px; height:500px; background-image:url('https://i1066.photobucket.com/albums/u409/magneato1/image4_zpsixuqksa5.jpg'); background-size: 600px 500px; }
div.Image5BlockB { width:600px; height:500px; background-image:url('https://i1066.photobucket.com/albums/u409/magneato1/image4_zpsixuqksa5.jpg'); background-size: 600px 500px; }
div.Image4BlockB { width:600px; height:500px; background-image:url('https://i1066.photobucket.com/albums/u409/magneato1/image4_zpsixuqksa5.jpg'); background-size: 600px 500px; }
div.Image5BlockB { width:600px; height:500px; background-image:url('https://i1066.photobucket.com/albums/u409/magneato1/image4_zpsixuqksa5.jpg'); background-size: 600px 500px; }
#table {
display: table; /* imitates the table behavior */
border: 1px solid;
border: 1px outset grey;
padding: 1px;
}
.table-cell {
margin: 1;
border: thin inset grey;
display: table-cell;
}
section {
display: none;
}
input {
display: none;
}
label {
display: inline-block;
font-weight: 600;
color: #bbb;
border: 1px solid transparent;
}
label:hover {
cursor: hand;
border: 1px solid #eee;
box-shadow: 1px 1px 5px #000;
}
label {
margin: 0 5px 0 0;
}
input:checked + label {
border: 1px solid #155179;
box-shadow: 2px 2px 7px #c0c0c0;
}
#tab1:checked ~ #content1,
#tab2:checked ~ #content2,
#tab3:checked ~ #content3,
#tab4:checked ~ #content4,
#tab5:checked ~ #content5 {
display: table-cell; /* imitates the td behavior */
border: thin inset grey;
margin: 1;
}
<div id="table">
<tr>
<td>
<input id="tab1" type="radio" name="tabs" checked>
<label for="tab1"><div class="Image1BlockS"></div></label>
<input id="tab2" type="radio" name="tabs">
<label for="tab2"><div class="Image2BlockS"></div></label>
<input id="tab3" type="radio" name="tabs">
<label for="tab3"><div class="Image3BlockS"></div></label>
<input id="tab4" type="radio" name="tabs">
<label for="tab4"><div class="Image4BlockS"></div></label>
<input id="tab5" type="radio" name="tabs">
<label for="tab5"><div class="Image5BlockS"></div></label>
</td>
<div class="table-cell">
2nd cell
</div>
<td>
3rd cell with the td element but without the border which doesn't work if there's no table element
</td>
<div class="table-cell">
4th cell
</div>
<section id="content1">
<div class="Image1BlockB"></div>
</section>
<section id="content2">
<div class="Image2BlockB"></div>
</section>
<section id="content3">
<div class="Image3BlockB"></div>
</section>
<section id="content4">
<div class="Image4BlockB"></div>
</section>
<section id="content5">
<div class="Image5BlockB"></div>
</section>
</tr>
</div>
This is essentially what I want to do, but putting the large image elements into another cell breaks it, the large image no longer shows up, I need to rewrite it so that I can put the large image anywhere throughout the template and still be able to have the small thumbnails change it when they're clicked on.
<table border=1><tr><td>
<input id="tab1" type="radio" name="tabs" checked>
<label for="tab1"><div class="Image1BlockS"></div></label>
<input id="tab2" type="radio" name="tabs">
<label for="tab2"><div class="Image2BlockS"></div></label>
<input id="tab3" type="radio" name="tabs">
<label for="tab3"><div class="Image3BlockS"></div></label>
<input id="tab4" type="radio" name="tabs">
<label for="tab4"><div class="Image4BlockS"></div></label>
<input id="tab5" type="radio" name="tabs">
<label for="tab5"><div class="Image5BlockS"></div></label>
</td>
<td>
<section id="content1">
<div class="Image1BlockB"></div>
</section>
<section id="content2">
<div class="Image2BlockB"></div>
</section>
<section id="content3">
<div class="Image3BlockB"></div>
</section>
<section id="content4">
<div class="Image4BlockB"></div>
</section>
<section id="content5">
<div class="Image5BlockB"></div>
</section>
</td>
</tr></table>

How to put clear button beside p:calendar?

I have a form which contains multiple elements, i have a primefaces calendar inside this form and i want to add a button beside the calendar input to allow user to set the date to null and clear the input field.
<div class="form-group">
<label class="control-label col-md-3 col-sm-3 col-xs-12" for="date-depart">Date Départ
</label>
<div class="row calendar-exibit col-md-3 col-sm-6 col-xs-12">
<fieldset style="margin-bottom: -10px">
<div class="control-group">
<div class="controls">
<div class="col-md-11 xdisplay_inputx form-group has-feedback" style="width: 85.667%; padding-left: 0px; border-radius: 3px;">
<p:calendar class="col-md-6 col-sm-6 col-xs-12" locale="fr" id="ddepart" readonlyInput="true" pattern="dd/MM/yyyy" mask="true" value="#{travailleMB.datedepart}" placeholder="--- Date Depart ---" style="border-radius: 3px; font-size: 12px; padding-right: 9px; padding-top: 3px;">
<p:ajax event="dateSelect" listener="#{travailleMB.saveSelect}" process="#this"/>
</p:calendar>
</div>
</div>
<div>
<h:button value="X" style="border-radius: 3px; font-size: 12px; margin-left:300px;"></h:button>
</div>
</div>
</fieldset>
</div>
</div>
the following image is the result of this source code : Form with input fields and the button
I tried to put the button in different places of this form-group without success
Hope someone knows how to do it
I have this structure with the help of following HTML and CSS:
HTML:
<div class="input-group">
<p:calendar styleClass="form-control radius-none" value="#{xBean.dateValue}" />
<span class="input-group-addon radius-none">
<p:commandLink actionListener="#{xBean.clearDateValue}">
<i class="fa fa-times"></i>
</p:commandLink>
</span>
</div>
CSS:
.input-group {
width: 100%;
display: table;
position: relative;
border-collapse: separate;
}
.input-group .form-control,
.input-group-addon,
.input-group-addon-with-link,
.input-group-btn {
display: table-cell !important;
}
.form-control {
display: block!important;
padding: 6px 12px!important;
font-size: 14px!important;
line-height: 1.42857143!important;
color: #555!important;
background-color: #fff!important;
background-image: none!important;
border: 1px solid #ccc!important;
border-radius: 4px;
margin-bottom: 0!important;
}
.radius-none {
border-radius: 0!important;
}
.input-group-addon:last-child,
.input-group-addon-with-link:last-child {
border-left: 0;
}
.input-group-addon,
.input-group-addon-with-link a,
.input-group-addon-with-link span {
padding: 13px 15px;
}
.input-group-addon,
.input-group-addon-with-link {
font-size: 14px;
font-weight: 400;
line-height: 1;
color: #555;
text-align: center;
background-color: #fff;
border: 1px solid #ccc;
}
.input-group-addon,
.input-group-addon-with-link,
.input-group-btn {
width: 1%;
white-space: nowrap;
vertical-align: middle;
}
Hope this will help you out!

How to align input box with div

I am trying to align some stuff in a login page. I want the pictures to appear left to the input boxes and the buttons on the down part of the div to be left and right. Something like this:
But this is what is happening (on Safari. Chrome works kinda OK as you can see on top image)
The problem is that although it partially works on Chrome, the input boxes are too small and I can't increase their size.
This is the code I am trying to use:
// Outer white DIV for the forms and buttons:
.login-form {
width: 360px;
height: 300px;
text-align: center;
margin-left: auto;
margin-right: auto;
padding: 19px 29px 29px 19px;
color: #444444;
background: rgba(253, 253, 253, 1.000);
border-radius: 7px;
-webkit-border-radius: 7px;
-moz-border-radius: 7px;
border: solid 1px rgba(144, 144, 144, 0.075);
}
// Login field for e-mail:
.login-field-up {
margin-bottom: 5px;
margin-top: 10px;
margin-right: 100px;
float: left;
display: inline-block;
}
/ Login field for password:
.login-field-down {
margin-top: 10px;
margin-bottom: 15px;
float: left;
}
// DIV for Icons of user credential and golden key:
.login-icon {
margin-top: 15px;
margin-right: 15px;
float: left;
display: inline-block;
}
// Right checbox:
.right-col {
float: right;
text-align: center;
margin-top: 10px;
}
Left blue login button:
.left-col {
float: left;
margin-left: 10px;
}
If there is any other easy way to do it, I am up to it. Since I have always worked with backend, I suck with CSS.
<section id="banner">
<h2>Title</h2>
<section>
<div id="skel-layers-wrapper" class="login-form">
<form method="post" action="{% url 'principal' %}">
<div class="login-icon">
<img src="{% static "icons/identity.png" %}" class="icons">
</div>
<div class="login-field-up">
<input type="text" name="username" id="username" placeholder="E-mail" />
</div>
<div class="login-icon">
<img src="{% static "icons/key_user.png" %}" class="icons">
</div>
<div class="login-field-down">
<input type="password" name="password" id="username" placeholder="Password" />
</div>
<div class="left-col">
<input type="submit" value="Login!" class="button" />
</div>
<div class="right-col">
<input type="checkbox" id="remember_login" checked="" name="remember_login" class="6u$ 12u$(3)">
<label for="remember_login" style="color:#5C5C5C">Remember me <img src="{% static "icons/lock_gold_16.png" %}" class="icons"></label>
</div>
</form>
</div>
</section>
</section>
You can increase the size of your input boxes by setting the "font-size" attribute in your style sheet, for example,
input {
font-size:2em;
}
And you can align images with input boxes by using <label></label>, for example,
<label for="email"><img src="image.png" /></label>
<input type="email" placeholder="E-mail" name="email" />
Or, you can also place the images in a separate div and the inputs in another div and then adjust the width, margin or padding to align them the way you want.
But as Billy said, if you post your html code, it will be easier to provide a solution.
EDIT: Thanks for your code. I think you wanted to achieve something like this. I added some borders to help you understand the positioning of the divs. Remove them and change the urls for the images once you are done debugging.
<!DOCTYPE html>
<html>
<head>
<style>
.login-form {
width: 360px;
height: 300px;
margin-left: auto;
margin-right: auto;
padding: 19px 29px 29px 19px;
color: #444444;
background: rgba(253, 253, 253, 1.000);
border-radius: 7px;
-webkit-border-radius: 7px;
-moz-border-radius: 7px;
border: solid 1px rgba(144, 144, 144, 0.075);
border:1px solid black;
}
#title-header {
text-align:center;
}
#username, #password {
margin-left:20px;
}
input {
font-size:1em;
}
img {
width:16px;
height:16px;
}
.login-field-up {
margin-left:50px;
width:250px;
border:1px solid black;
}
.login-field-down {
margin-left:50px;
width:250px;
border:1px solid black;
margin-top:20px;
margin-bottom:20px;
}
.login-icon {
border:1px solid black;
}
.right-col {
float:left;
width:160px;
margin-left:30px;
border:1px solid black;
}
.left-col {
margin-left:50px;
float:left;
width:60px;
border:1px solid red;
}
.inner-wrapper {
margin-top:50px;
width:350px;
height:150px;
border:1px solid red;
}
</style>
<section id="banner">
<h2 id="title-header">Title</h2>
<section>
<div id="skel-layers-wrapper" class="login-form">
<form method="post" action="{% url 'principal' %}">
<div class="inner-wrapper">
<div class="login-field-up">
<img src="image.png">
<input type="text" name="username" id="username" placeholder="E-mail" />
</div>
<div class="login-field-down">
<img src="image.png">
<input type="password" name="password" id="password" placeholder="Password" />
</div>
<div class="left-col">
<input type="submit" value="Login!" class="button" />
</div>
<div class="right-col">
<input type="checkbox" id="remember_login" checked="" name="remember_login" class="6u$ 12u$(3)">
<label for="remember_login" style="color:#5C5C5C">Remember me <img src="{% static "icons/lock_gold_16.png" %}" class="icons"></label>
</div>
</div>
</form>
</div>
</section>
</section>

Modal label elements wrapping to newline in webkit browsers

I'm currently having a problem with CSS styles in Webkit browswers (Chrome 4.0.249.89 & safari 4.0.4) in which I have a modal window that has a list of labels, radio buttons and some more text describing the what each radio button does. The modal displays correctly in FF 3.5.7
Here's the html for inside the modal,
<div id="rta_top">
<img src="pb_close_off.png" width="17" height="15" alt="Close this window" title="Close this window" id="rta_close" />
<h2 class="rta">Report</h2>
</div>
<div id="pb_bottom">
<div id="error_holder">
<div id="error"></div>
</div>
<br />
Please choose a reason for reporting this ad:
<form action="submit.php" method="post" id="report_form">
<fieldset>
<br />
<label for="incorrect_address">Wrong Address:</label>
<div class="report_ad_radio">
<input type="radio" id="incorrect_address" name="description" value="1" />
</div>
<div class="report_ad_text">
<label for="incorrect_address"> (Ad has wrong address).</label>
</div>
<br />
<label for="duplicate">Duplicate:</label>
<div class="report_ad_radio">
<input type="radio" id="duplicate" name="description" value="2" />
</div>
<div class="report_ad_text">
<label for="duplicate"> (Identical to another ad on-site).</label>
</div>
<br />
<label for="mis_classified">Mis-Classified:</label>
<div class="report_ad_radio">
<input type="radio" id="mis_classified" name="description" value="3" />
</div>
<div class="report_ad_text">
<label for="mis_classified"> (Ad is in the wrong section).</label>
</div>
<br />
<label for="inaccurate">Inaccurate:</label>
<div class="report_ad_radio">
<input type="radio" id="inaccurate" name="description" value="4" />
</div>
<div class="report_ad_text">
<label for="inaccurate"> (No longer available / price changed).</label>
</div>
<br />
<label for="photos">Photo Issue:</label>
<div class="report_ad_radio">
<input type="radio" id="photos" name="description" value="5" />
</div>
<div class="report_ad_text">
<label for="photos"> (Photos are inappropriate or do not belong to this ad).</label>
</div>
<br />
<label for="spam">Spam:</label>
<div class="report_ad_radio">
<input type="radio" id="spam" name="description" value="6" />
</div>
<div class="report_ad_text">
<label for="spam"> (Ad is spam/scam and is not exclusive).</label>
</div>
<br />
<label for="other">Other:</label>
<div class="report_ad_radio">
<input type="radio" id="other" name="description" value="7" />
</div>
<div class="report_ad_text">
<label for="other"> (Other reason, please specify).</label>
</div>
<br />
<br />
<label for="more_info">More Info:</label>
<textarea id="information" name="information"></textarea>
<br />
<br />
<div id="sending">
<div id="loader"></div>
<input type="hidden" name="submit_report_ad" value="1" />
<input type="image" src="/i/button_send_off.png" id="reply_button" name="submit_reply" value="Send »" />
</div>
</fieldset>
</div>
</div>
and the css for each element:
#rta_background {
padding: 10px;
background: url(/i/bg_modal_ra.png) no-repeat;
}
#ra_background_sent{
padding: 10px;
background: url(/i/bg_modal_ra_sent.png) no-repeat;
}
#rta_top {
padding: 0 8px 0 18px;
background: #355eae url(/i/bg_linkbar_off.png) repeat-x;
height: 30px;
line-height: 30px;
}
#rta_top h2 {
overflow: hidden;
width: 495px;
height: 30px;
font-size: 14px;
color: #fff;
}
#rta_close {
margin: 7px 0 0;
float: right;
}
#rta #pb_bottom fieldset {
background: #dff;
}
.report_ad_radio {
padding: 5px 0 0 5px;
float: left;
}
#rta #pb_bottom .rta_warning {
margin: 0 auto 6px;
border: 1px solid #f00;
padding: 2px 0;
width: 80%;
height: 15px;
line-height: 15px;
font-size: 12px;
font-weight: bold;
color: #000;
text-align: center;
background: #fdd;
}
#rta #pb_bottom .report_ad_text {
white-space: nowrap;
}
#rta #pb_bottom .report_ad_text label {
margin: 0;
padding: 10px 0 0 0;
width: auto;
font-size: 12px;
font-weight: normal;
cursor: pointer;
background: #00f000;
}
#information {
margin: 5px 0 0 5px;
padding: 2px 2px 2px 2px;
width: 370px;
height: 76px;
border: 1px solid #ccc;
color: #888;
line-height: 1.4;
resize: none;
}
#sending {
float:right;
margin-right: 24px;
}
#pb_bottom #error {
margin: 0 20px 0 50px;
height: 20px;
width: 420px;
}
#loader {
margin-right: 20px;
margin-top: 6px;
float:left;
}
In Safari it looks like this:
Safari http://neilcremins.com/img_dump/modal-saf.png
In Firefox it looks like this:
Firefox http://neilcremins.com/img_dump/modal-ff.png
Wow. Div-soup with everything defined in absolute measures. I don't know where to start. I know, I'll start here: you can only have one label per input, so... let's try this:
HTML:
<label><span class="intro">Wrong address</span><input type="radio" id="wrongaddress"/>(Ad has wrong address)</label>
CSS:
label{display: block}
.intro{width: 12em; float: left; font-weight: bold}
Demo.
Less is more.

Resources