JavaScript not accepted this time.
So, I have this CSS code. This code should change to width if radio button is checked. Nothing happens. How could I modify the code?
input[type="radio"]#someID-1:checked #extra { width: 4000px; }
I also have this HTML code:
<div id="kaaviotaulukko" style="white-space: nowrap; position: relative; text-align: center;">
<div style="display: inline-block">
<div style="DISPLAY:INLINE-BLOCK">
<input id="someID-1" name="nappi" type="radio">
<div class="listaus-sisalto" style="float:left;width:0">
<div id="navi3">
<div style="z-index:100;position:fixed;right:0;top:300px">
<span><label for="someID-1">1</label></span>
</div>
</div>
</div>
<div class="kierros" style="display: inline-block;width:350px">
R1
</div>
</div>
<div style="DISPLAY:INLINE-BLOCK">
<input id="someID-5" name="nappi" type="radio">
<div class="listaus-sisalto" style="float:right;width:0">
<div id="navi5"></div>
</div>
<div class="kierros" id="extra" style="display: inline-block;width:70px">
extra
</div>
</div>
<input id="someID-100" name="nappi" type="radio">
<div class="listaus-sisalto" style="float:right;width:0">
<div id="navi100"></div>
</div>
<div style="z-index:99;width:70px;position:fixed;left:0;top:100px;margin:auto;background-color:red">
<br>
</div>
<div style="z-index:99;width:70px;position:fixed;right:0;top:100px;margin:auto;background-color:red">
<br>
</div>
</div>
</div>
There is no child #extra of that input. Just remove that from the selector.
input[type="radio"]#someID-1:checked {
width: 4000px;
}
<div id="kaaviotaulukko" style="white-space: nowrap; position: relative; text-align: center;">
<div style="display: inline-block">
<!--
-->
<DIV STYLE="DISPLAY:INLINE-BLOCK"><input name="nappi" type="radio" id="someID-1" />
<div class="listaus-sisalto" style="float:left;width:0">
<div id="navi3">
<div style="z-index:100;position:fixed;right:0;top:300px"><span><label for="someID-1">1</label></span></div>
</div>
</div>
<div class="kierros" style="display: inline-block;vertical-align:top;width:350px">R1
</div>
</DIV>
<!--
-->
<DIV STYLE="DISPLAY:INLINE-BLOCK"><input name="nappi" type="radio" id="someID-5" />
<div class="listaus-sisalto" style="float:right;width:0">
<div id="navi5">
</div>
</div>
<div class="kierros" style="display: inline-block;vertical-align:top;width:70px" id="extra">extra
</div>
</DIV>
<!--
--><input name="nappi" type="radio" id="someID-100" />
<div class="listaus-sisalto" style="float:right;width:0">
<div id="navi100">
</div>
</div>
<!--
-->
<div style="z-index:99;width:70px;position:fixed;left:0;top:100px;margin:auto;background-color:red"><br />
</div>
<div style="z-index:99;width:70px;position:fixed;right:0;top:100px;margin:auto;background-color:red"><br />
</div>
</div>
</div>
The selector input[type="radio"]#someID-1:checked #extra selects an element with the id extra that is a child element of your radio button. Since radio buttons rarely have children, you'll need to change the selector to match your HTML structure.
I suggest placing the radio button inside the same parent element as #extra. That way you can use the selector input[type="radio"]#someID-1:checked ~ #extra which will target the #extra element if it is preceded by the radio button in selected state.
A simplified version of what you'd like to become.
#radiodiv {
background: red;
}
#radio:checked + #radiodiv {
width: 400px;
}
<input id="radio" type="radio" />
<div id="radiodiv">
<p>This is the div</p>
</div>
Related
I have a snippet with my code of section height height: 450px;. Please see snippet:
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
<style>
.get-tour .form-block {
display: inline-block;
}
.get-tour .form-block label {
display: block;
}
</style>
<section style="min-height: 450px">
<div class="container">
<div class="row">
<div class="col-lg-8">
Use the .flex-fill class on a series of sibling elements to force them into widths .... align-items , flex-direction: column , and margin-top: auto
</div>
<div class="col-lg-3">
Use the .flex-fill class on a series of sibling elements to force them into widths .... align-items , flex-direction: column , and margin-top: auto
</div>
</div>
<div class="element">
<div class="get-tour d-flex align-items-end">
<form action="">
<div class="form-block">
<label>When</label>
<input type="text">
</div>
<div class="form-block">
<label>Date </label>
<input type="text">
</div>
<div class="form-block">
<label>Qty ночей</label>
<input type="text">
</div>
<div class="form-block">
<label>Who</label>
<input type="text">
</div>
<div class="form-block">
<label>Type</label>
<input type="text">
</div>
<div class="form-block">
<button type="submit">Search</button>
</div>
</form>
</div>
</div>
</div>
</section>
How I can put to bottom my form get-tour with flexbox? I tried add class d-flex align-items-end but my code is not work. Why? If I set height: 100% to container or on my section also not work. Please help fix this issue. Thanks.
If I set height: 100% to container or on my section also not work.
You need to set body and html's height to 100% as well. Because they wrap all of your content.
Then, you can use flexbox layout model to put your get-tour at the bottom of your page.
body,
html {
height: 100%;
}
section {
height: 100%;
}
section .container {
height: 100%;
display: flex;
flex-direction: column;
justify-content: space-between;
}
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
<style>
.get-tour .form-block {
display: inline-block;
}
.get-tour .form-block label {
display: block;
}
</style>
<section style="min-height: 450px">
<div class="container">
<div class="row">
<div class="col-lg-8">
Use the .flex-fill class on a series of sibling elements to force them into widths .... align-items , flex-direction: column , and margin-top: auto
</div>
<div class="col-lg-3">
Use the .flex-fill class on a series of sibling elements to force them into widths .... align-items , flex-direction: column , and margin-top: auto
</div>
</div>
<div class="element">
<div class="get-tour ">
<form action="">
<div class="form-block">
<label>When</label>
<input type="text">
</div>
<div class="form-block">
<label>Date </label>
<input type="text">
</div>
<div class="form-block">
<label>Qty ночей</label>
<input type="text">
</div>
<div class="form-block">
<label>Who</label>
<input type="text">
</div>
<div class="form-block">
<label>Type</label>
<input type="text">
</div>
<div class="form-block">
<button type="submit">Search</button>
</div>
</form>
</div>
</div>
</div>
</section>
I have a theme which have this section below , I want to align the text on the right side of a radio button, right now it below the radio button
Here is what I want:
Here is jsfiddle: http://jsfiddle.net/Mwanitete/Jm2JR/181/
<div class="delivery_options">
<div class="delivery_option item" style="margin: 0px;padding: 0px;">
<div>
<label class="delivery-option-label" for="delivery_option_13687_0">
<div class="resume div div-bordered">
<div>
<div class="delivery_option_radio">
<input id="delivery_option_13687_0" class="delivery_option_radio" type="radio" name="delivery_option[13687]" data-key="233," data-id_address="13687" value="233,">
</div>
<div class="delivery_option_logo">
</div>
<div>
Kurier DHL (2-5dni roboczych)
<span class="delivery_option_price">
12,00 zł
</span>
<br>
<span class="best_grade best_grade_speed">The fastest</span>
</div>
</div>
</div>
</label>
</div>
</div>
<!-- end delivery_option -->
<div class="delivery_option alternate_item" style="margin: 0px; padding: 0px; float: none;">
<div>
<label class="delivery-option-label" for="delivery_option_13687_1">
<div class="resume div div-bordered">
<div>
<div class="delivery_option_radio">
<input id="delivery_option_13687_1" class="delivery_option_radio" type="radio" name="delivery_option[13687]" data-key="234," data-id_address="13687" value="234,">
</div>
<div class="delivery_option_logo">
</div>
<div>
Kurier DHL - pobranie (2-5 dni roboczych)
<span class="delivery_option_price">
12,00 zł
</span>
<br>
</div>
</div>
</div>
</label>
</div>
</div>
<!-- end delivery_option -->
<div class="delivery_option item" style="margin: 0px; padding: 0px; float: none;">
<div>
<label class="delivery-option-label" for="delivery_option_13687_2">
<div class="resume div div-bordered">
<div>
<div class="delivery_option_radio">
<input id="delivery_option_13687_2" class="delivery_option_radio" type="radio" name="delivery_option[13687]" data-key="235," data-id_address="13687" value="235,">
</div>
<div class="delivery_option_logo">
</div>
<div>
Odbiór osobisty - Showroom - Mokotowska 40/3, Warszawa (2-3 dni roboczych)
<span class="delivery_option_price">
Free
</span>
<br>
<span class="best_grade best_grade_price">The best price</span>
</div>
</div>
</div>
</label>
</div>
</div>
<!-- end delivery_option -->
<div class="delivery_option alternate_item" style="margin: 0px; padding: 0px; float: none;">
<div>
<label class="delivery-option-label" for="delivery_option_13687_3">
<div class="resume div div-bordered">
<div>
<div class="delivery_option_radio">
<input id="delivery_option_13687_3" class="delivery_option_radio" type="radio" name="delivery_option[13687]" data-key="231," data-id_address="13687" value="231," checked="checked">
</div>
<div class="delivery_option_logo">
</div>
<div>
Odbiór osobisty - Sklep - Stary Browar, Poznań (2-5 dni roboczych)
<span class="delivery_option_price">
Free
</span>
<br>
</div>
</div>
</div>
</label>
</div>
</div>
<!-- end delivery_option -->
</div>
I tried using float but didnt work, any idea or help, suggestion will be apreciated, please help
add this line to your css
.resume > div {
display: flex;
}
I have nested <hr> tag in my html, without using specified traversing, how can I hide the last hr using css but not js? I can skip the loop using js but I want to use pure css, not sure why :nth-of-type(1) hide all the <hr>
<div class="modal-body">
<div class="row">
<div class="m-l-20 m-r-20">
<div><strong class="m-b-10">Indonesia</strong></div>
<div>
<div class="item">
<label>
<div class="item">
<label>
<span>Lazada ID</span></label>
</div>
</div>
<hr>
</div>
<div class="m-l-20 m-r-20">
<div><strong class="m-b-10">Malaysia</strong></div>
<div>
<div class="item">
<label>
<span>Lazada MY</span></label>
</div>
<div class="item">
<label>
<span>Lelong MY</span></label>
</div>
</div>
<hr>
</div>
<div class="m-l-20 m-r-20">
<div><strong class="m-b-10">Others</strong></div>
<div>
<div class="item">
<label>
<span>Alibaba</span></label>
</div>
</div>
<hr>
</div>
</div>
</div>
https://jsfiddle.net/g59e21ps/1/
Your solution is here...
.modal-body .row div:last-child hr {
display: none;
}
:nth[-last]-of-type is the nth last child of a given tag type in its parent element – not the nth last match in the entire document. You can find <hr>s that are children of last children with the child combinator >:
.modal-body :last-child > hr {
display: none;
}
updated fiddle
Try the following snippet.
.modal-body .row div:last-child hr {
display: none;
}
<div class="modal-body">
<div class="row">
<div class="m-l-20 m-r-20">
<div><strong class="m-b-10">Indonesia</strong></div>
<div>
<div class="item">
<label>
<div class="sa-checkbox theme__blue checked" style="position: relative;">
<input type="checkbox" cursor="false" name="5a60626f1d41c80c8d3f8a85" value="on" style="position: absolute; opacity: 0;"><ins class="iCheck-helper" style="position: absolute; top: 0%; left: 0%; display: block; width: 100%; height: 100%; margin: 0px; padding: 0px; background: rgb(255, 255, 255); border: 0px; opacity: 0; cursor: pointer;"></ins></div><span>Bukalapar</span></label>
</div>
<div class="item">
<label>
<span>Lazada ID</span></label>
</div>
</div>
<hr>
</div>
<div class="m-l-20 m-r-20">
<div><strong class="m-b-10">Malaysia</strong></div>
<div>
<div class="item">
<label>
<span>Lazada MY</span></label>
</div>
<div class="item">
<label>
<span>Lelong MY</span></label>
</div>
</div>
<hr>
</div>
<div class="m-l-20 m-r-20">
<div><strong class="m-b-10">Others</strong></div>
<div>
<div class="item">
<label>
<span>Alibaba</span></label>
</div>
</div>
<hr>
</div>
</div>
</div>
I have a simple css which floats elements to the left and creates a table structure. I wanted the table to be dynamic, being able to add a column if the user expands the browser so I have used elements that float left. However it sometimes does not work. I have created a jsfiddle that shows the scenario.
It works for one column, two columns but it does not work for three columns and it leaves a gap.
I cannot understand why it is leaving that gap. Here's the fiddle
http://jsfiddle.net/workmonitored/hgt9Lp5n/12/
html
<div style="margin-left:5px;margin-right:15px">
<div class="keepTogether">
<div class="description">Flows 1:</div>
<div class="userOutput">
<input type="text" name="DetailProjectReportingPeriodDetailEditUI.employeeName">
</div>
</div>
<div class="keepTogether">
<div class="description">Flows 2:</div>
<div class="userOutput">
<input type="text" name="DetailProjectReportingPeriodDetailEditUI.employeeName">
</div>
</div>
<div class="keepTogether">
<div class="description">Flows 3:</div>
<div class="userOutput">
<input type="text" name="DetailProjectReportingPeriodDetailEditUI.employeeName">
</div>
</div>
<div class="keepTogether">
<div class="description">Flows 4:</div>
<div class="userOutput">
<input type="text" name="DetailProjectReportingPeriodDetailEditUI.employeeName">
</div>
</div>
<div class="keepTogether">
<div class="description">Employee Name:</div>
<div class="userOutput">
<input type="text" name="DetailProjectReportingPeriodDetailEditUI.employeeName" style="width: 90%">
</div>
</div>
<div class="keepTogether">
<div class="description">Affiliation</div>
<div class="userOutput">
<select>
<option value="1">Member</option>
<option value="1">Member Spouse</option>
</select>
</div>
</div>
<div class="keepTogether">
<div class="description">Job Title</div>
<div class="userOutput">
<select>
<option value="1">Mr smith</option>
<option value="1">Mrs smith</option>
</select>
</div>
</div>
<div class="keepTogether">
<div class="description">Classification</div>
<div class="userOutput">
<select>
<option value="1">Worker Bee</option>
<option value="1">Grasshoper Initiate</option>
</select>
</div>
</div>
<div class="keepTogether">
<div class="description">Hire Date</div>
<div class="userOutput">
<input type="text" id="hiredate" name="DetailProjectReportingPeriodDetailEditUI.hireDateStr" style="width: 90%">
</div>
</div>
<div class="keepTogether">
<div class="description">Job Status</div>
<div class="userOutput">
<input type="text" id="hiredate" name="DetailProjectReportingPeriodDetailEditUI.hireDateStr" style="width: 90%">
</div>
</div>
<div class="keepTogether">
<div class="description">Pay Scale</div>
<div class="userOutput">
<input name="DetailProjectReportingPeriodDetailEditUI.payScale" size="12">
</div>
</div>
<div class="keepTogether">
<div class="description">Notes</div>
<div class="userOutput">
<textarea rows="1" name="DetailProjectReportingPeriodDetailEditUI.note" style="width: 99%"></textarea>
</div>
</div>
<div style="clear:both; height:5px"></div>
<div class="keepTogether">
<button id="saveReportingPeriodDetail">Save</button>
<button id="cancelReportingPeriodDetail">Cancel</button>
</div>
css
.description {
width: 120px;
float: left;
}
.userOutput {
width: 240px;
float: left;
}
.userInput {
width: 240px;
float: left;
}
.keepTogether {
display:inline;
float:left;
margin-bottom: 2px;
}
.keepTogether select {
width: 220px;
}
.keepTogether input {
width: 120px;
float: left;
}
Thanks in advance.
Setting the margin on input and select elements to 0 sorted out the issue also.
.keepTogether input {
width: 120px;
float: left;
margin: 0;
}
http://jsfiddle.net/hgt9Lp5n/13/
In this bootply the welcome as well as the form is coming on the left hand side.But I want to bring it at the centre.Can any body please tell me how to do?
<form id="form1">
<div class="container-fluid">
<div class="row-fluid">
<div class="span1"></div>
<div class="span10" style="margin-bottom: 6px; margin-top: 0px; background: #efeee9">
<img src="ui_resources/img/ title.jpg" alt="" align="left">
<h2 align="center" style="margin-top: 18px;"></h2>
</div>
<div class="span1"></div>
</div>
<div class="row-fluid">
<div class="span1"></div>
<div class="span10" style="background: #eee; border: 1px solid #ddd;">
<div class="span7 center login-header">
<h2 style="color:#E86537 " align="center">Welcome </h2>
</div><!--/span-->
<div class="row-fluid">
<div class="well span7 center login-box">
<div class="alert alert-info">
Please login with your Username and Password.
</div>
<fieldset>
<div class="input-prepend" title="Username" data-rel="tooltip" style="margin-left:80px;">
<span class="add-on"><i class="icon-user"></i></span><input autofocus="" class="input-large span10" name="j_username" id="username" type="text" value="">
</div>
<div class="clearfix"></div>
<div class="input-prepend" title="Password" data-rel="tooltip" style="margin-left:80px;">
<span class="add-on"><i class="icon-lock"></i></span><input class="input-large span10" name="j_password" id="password" type="password" value="">
</div>
<div class="clearfix"></div>
<div class="input-prepend" style="margin-left:80px;">
<label class="remember" for="remember"><input type="checkbox" id="remember" style="display:">Remember me</label>
</div>
<div class="clearfix"></div>
<p class="center span6" style="margin-left:80px;">
<button type="submit" class="btn btn-primary">Login</button>
New Userregister
</p>
</fieldset>
</div><!--/span-->
</div><!--/row-->
</div><!--/row-->
</div>
<div class="span1"></div>
</div></form>
<div class="row-fluid">
<div class="span1"></div>
<div class="span10" style="margin-top: 6px;">
<div class="span1"></div>
</div>
</div>
try to set your welcome div in another div like this
<div class="row-fluid">
<div class="offset3 span6 center login-header">
<h2 style="color:#E86537 " align="center">Welcome </h2>
</div>
</div>
use offset
Move columns to the right using .offset* classes. Each class increases
the left margin of a column by a whole column. For example, .offset4
moves .span4 over four columns.
DEMO
Try using this in your CSS
.row-fluid .login-header,
.row-fluid .login-box{
float:none;
margin:0 auto !important;
}
Since .span* has float: left style by default, you can override it by using float:none;
.login-box {
margin:0 auto;
float:none;
}
margin:0 auto; is used to center your loginbox horizontally.