place input checkbox in same line of label - css

i am struggling to place input check-box in same line x-horizontal as in label. My check-box is placing in 2nd line. I have a div with background to image then label and then check-box. The margin between image and label div and margin between label and check need to be same. Many thanks in advance.
<div id="map_Marker_Check_Block">
<div class="markerDiv" id="maker_school"><div class="marker_label">School</div> <input class="marker_ckeckbox" name="markerType" value="school" type="checkbox" /> </div> <br />
<div class="markerDiv" id="maker_gym"> <div class="marker_label">Gym</div> <input class="marker_ckeckbox" name="markerType" value="gym" type="checkbox" /> </div><br />
</div>
css
#map_Marker_Check_Block {
background-color:yellow;
display:block;
position:absolute;
width:20em;
height:400px;
top:0;
right:0;
z-index:10;
overflow-y:auto;
}
.marker_label {
margin-left:50px;
line-height:48px;
width:130px;
background-color:green;
}
.marker_ckeckbox {
float:right;
}
.markerDiv {
width:19em;
height:48px;
margin-left:5px;
}
#maker_school { background: url("img1.png") no-repeat; }
#maker_gym{ background: url("img2.png") no-repeat; }

http://jsfiddle.net/XUErp/
.marker_label {
float:left;
margin-left:50px;
line-height:48px;
width:130px;
background-color:green;
}
.marker_ckeckbox {
margin-top:15px;
float:right;
}

Use TOP and POSITION styles for checkbox:
.marker_ckeckbox {
float: right;
position: relative;
top: -35px;
}
But, I think the elements must be structured in a different way.
Or as Musa said use label instead of div:
Sample: http://jsfiddle.net/qaprB/1/

try this
<div class="markerDiv" id="maker_school"><label class="marker_label">School</label> <input class="marker_ckeckbox" name="markerType" value="school" type="checkbox" /> </div> <br />
<div class="markerDiv" id="maker_gym"> <label class="marker_label">Gym</label> <input class="marker_ckeckbox" name="markerType" value="gym" type="checkbox" /> </div><br />
css
.marker_ckeckbox {
float:right;
position: relative;
top: -35px;
}
.marker_label {
display:block;
}

Related

dynamic div border based on radio button selection

I am having difficulty with this one. I am trying to change the border around the entire div (e.g. #option1) instead of just the text. As you can see, when you click each radio button it changes the border around the option text, but not the entire div. Any suggestions?
JSFIDDLE: https://jsfiddle.net/1hdv2n3h/1/
<div id="wine_club_selection">
<div id="option1">
<p><input type="radio" name="club_type" checked="checked" value="option 1"><br/>
<span class="bold_text">Option 1</span><br/>
3 Bottles<br/>
15% Discount<br/></p></div>
<div id="option2">
<p><input type="radio" name="club_type" value="option 2" ><br />
<span class="bold_text">Option 2</span><br />
6 Bottles<br />
20% Discount<br/>
</p></div>
<div id="option3">
<p><input type="radio" name="club_type" value="option 3"><br>
<span class="bold_text">Option 3</span><br />
12 Bottles<br />
25% Discount<br />
</p></div>
</div>
/* CSS: */
#wine_club_selection {
height:200px;
width:800px;
}
#option1 {
float:left;
width:266px;
}
#option1 p {
text-align:center;
}
#option2 {
float:left;
width:266px;
}
#option2 p {
text-align:center;
}
#option3 {
float:right;
width:266px;
text-align: center;
}
#option3 p {
text-align:center;
}
.bold_text {
font-weight:800;
}
.billing_table input {
font-size:18px;
color:#620101;
}
#option1 input[type="radio"]:checked ~ *{
border: thin solid #F00;!important;
}
#option2 input[type="radio"]:checked ~ *{
border: thin solid #F00;!important;
}
#option3 input[type="radio"]:checked ~ *{
border: thin solid #F00;!important;
}
I'm a bit anal-retentive about good-quality HTML, so I tidied yours up a little to make it more semantically-correct.
You can't use CSS to select the "parent" of an element -- only "sibling" elements that come after it -- so you have to sort-of fake it.
.options {
height:200px;
width:800px;
text-align:center;
}
.options li{
display:inline-block;
width:30%;
}
.options p{
margin:0;
}
.options header p{
font-weight:bold;
}
.options li div{
padding-top:1em;
}
.options li input{
position:relative;
top:2em;
}
.options li input:checked+div{
border:1px solid #f00;
}
<ul class="options">
<li>
<input type="radio" name="option" checked />
<div>
<header><p>Option 1</p></header>
<p>3 bottles</p>
<p>15% discount</p>
</div>
</li>
<li>
<input type="radio" name="option" />
<div>
<header><p>Option 2</p></header>
<p>6 bottles</p>
<p>20% discount</p>
</div>
</li>
<li>
<input type="radio" name="option" />
<div>
<header><p>Option 3</p></header>
<p>12 bottles</p>
<p>25% discount</p>
</div>
</li>
</ul>

Is it possible to do a concave and rounded corner of the same element?

I need it to look like this:
Here is the markup:
<div class="hni_vaBreadcrumbContainer">
<progress class="hni_vaBreadcrumbProgress" value="0" max="100"></progress>
<span class="hni_vaBreadcrumbContent">0%</span>
</div>
Here are a couple jfiddles I tried but couldn't get working:
http://jsfiddle.net/x4wLf/, http://jsfiddle.net/cogent/6A5Lb/
I could just use a background image for the percentage text but prefer all CSS.
thanks!
I think I actually figured it out with very little markup/css.
http://jsfiddle.net/o22b4uyz/2/
Markup
<div class='wrapper'>
<div class='concave'><span class="percent">20%</span></div>
</div>
CSS
div.wrapper {
background:blue;
width:80px;
height:20px;
position:relative;
border-radius: 50px;
}
div.concave {
position:absolute;
background:white;
width:20px;
height:20px;
border-radius:50px;
left:-3px;
}
span.percent {
padding-left: 40px;
color: #fff;
}

Align a dynamically created image in the right side of a div

I am trying to create a shopping list. The list is dynamically created using Javascript (jQueryUI). I want the thrash cans next to be on the right side (where this blue dots that I draw are). I tried to do it using left or style="right:350px" and float:right in tag but it didn't work.
Here is my code where it's row is generated:
var row=$('<div class"productsclass" id='+selectedproducts[i]+' style="width:400px">
<label style="font-size:20px">'+selectedproducts[i]+'</label><input type="text"
name="Quantity" value="1" id='+thesi+'><img class=delete
src="http://b.dryicons.com/images/icon_sets/handy_part_2_icons/png/128x128/recycle_bin.png"
height="22" width="22" style="right:350px"></div>');
rowID++;
$("#productstable").append(row);
Here is the html:
<div id="maindiv" class="maindiv">
<input id="autocomplete_text_field">
<button id="add_product_button">Add product</button>
<form action="#" id="productstable" name="productstable">
<p></p>
</form>
</div>
</body>
and here is the CSS:
#body{
background-color: #6E0D25
}
#maindiv {
position:absolute;
top: 50%;
left: 50%;
width:30em;
height:18em;
margin-top: -9em; /*set to a negative number 1/2 of your height*/
margin-left: -15em; /*set to a negative number 1/2 of your width*/
/*border: 1px solid #ccc;*/
background-color: #6E0D25;
}
#productstable
{
background-color:#F1EBE4;
border-radius:10px;
width:400px;
}
#product
{
width:380px;
}
#autocomplete_text_field
{
width:200px;
height:40px;
border-radius:10px;
}
#add_product_button
{
width:200px;
height:50px;
border-radius:10px;
}
How can I do it?
(Sorry if it is a very useless question, It's almost the first time I use CSS)
Solved after user2313440's answer:
Change img class=delete to img class="delete" then add float:right; to it in CSS.
just a simple rearrange of your img, and using float: right;
try this code instead:
var row=$(' <div class "productsclass" id='+selectedproducts[i]+' style="width:400px">
<img class=deletesrc="http://b.dryicons.com/images/icon_sets/handy_part_2_icons/png/128x128/recycle_bin.png" height="22" width="22" style="float: right;">
<label style="font-size:20px">'+selectedproducts[i]+'</label>
<input type="text" name="Quantity" value="1" id='+thesi+'>
</div>');
rowID++;
$("#productstable").append(row);

HTML - Compatibility Mode - Button Not Appearing

I have a basic page which is used in an iFrame on an intranet site. It is generated using ASP.NET, the generated source is as follows:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><title>
</title><link rel="Stylesheet" type="text/css" href="css/EDT.css" />
<script type="text/javascript" language="javascript" src="includes/ADIServices.js"></script>
</head>
<body>
<form name="form1" method="post" action="ADIServices.aspx?type=2&typename=contact&id=%7bA2755D17-67FF-4539-8AAE-327038D5E618%7d&orgname=RSAADI&userlcid=1033&orglcid=1033" id="form1">
<div>
<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/wEPDwUKLTg3NDY0NDE0Mg8WBh4IdXNlcm5hbWUFEG5rZW5ueUB2dWxjYW4uaWUeCWhhc2FjY2Vzc2ceBWFkaWlkKClYU3lzdGVtLkd1aWQsIG1zY29ybGliLCBWZXJzaW9uPTIuMC4wLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49Yjc3YTVjNTYxOTM0ZTA4OSRhMjc1NWQxNy02N2ZmLTQ1MzktOGFhZS0zMjcwMzhkNWU2MTgWAgIDD2QWAgIDDw8WAh4EVGV4dAUQbmtlbm55QHZ1bGNhbi5pZWRkGAEFHl9fQ29udHJvbHNSZXF1aXJlUG9zdEJhY2tLZXlfXxYDBQ9yYlVzZXJBY2Nlc3NZZXMFDnJiVXNlckFjY2Vzc05vBQ5yYlVzZXJBY2Nlc3NOb1LW6lJTh7HRxc/r9DmBabkk6Q+U" />
</div>
<div>
<input type="hidden" name="__EVENTVALIDATION" id="__EVENTVALIDATION" value="/wEWBwKT+7PEDAKl1bK4CQL62KvxCQLU6/3GAwLfl6DKCAK5ieyiCQLHst2vAuS7asmw5PqvB/FNK/KEPjCqeGEz" />
</div>
<div id="content">
<div id="username">
<span id="lblUsername" class="label">Username</span>
<input name="txtUsername" type="text" value="nkenny#xxxxxxx.xx" id="txtUsername" disabled="disabled" class="textbox" />
</div>
<div id="access">
<span id="lblUserAccess" class="label">Portal Access</span>
<div id="useraccessradiobuttons">
<span class="radiobutton"><input id="rbUserAccessYes" type="radio" name="rblUserAccess" value="rbUserAccessYes" checked="checked" /><label for="rbUserAccessYes">Yes</label></span>
<span class="radiobutton"><input id="rbUserAccessNo" type="radio" name="rblUserAccess" value="rbUserAccessNo" /><label for="rbUserAccessNo">No</label></span>
</div>
</div>
<div id="passwordchange">
<div id="newpassword">
<span id="lblNewPassword" class="label">New Password</span>
<input name="txtNewPassword" type="text" id="txtNewPassword" class="textbox" />
</div>
<div id="newpasswordrepeat">
<span id="lblRepeatPassword" class="label">Repeat Password</span>
<input name="txtRepeatPassword" type="text" id="txtRepeatPassword" class="textbox" />
</div>
<a id="lnkShowChangePasswordFields" class="link" OnClick="javascript:ShowHidePasswordFields()">Change Password</a>
</div>
</div>
<div id="submit">
<input type="submit" name="cmdSave" value="Save" onclick="return ValidateFields();" id="cmdSave" />
<span id="lblStatus"></span>
</div>
</form>
</body>
</html>
I have a stylesheet assoiciated with this:
body
{
background-color:#EAF3FF;
font-family:Tahoma;
font-size:11px;
}
input
{
font-family:Tahoma;
font-size:11px;
}
#content
{
width:350px;
}
.label
{
width:30%;
height:5px;
position:relative;
top:7px;
float:left;
}
.radiobutton
{
width:21%;
height:5px;
position:relative;
top:7px;
float:left;
}
.link
{
width:50%;
height:5px;
position:relative;
top:27px;
float:left;
color:blue;
text-decoration:underline;
}
.textbox
{
width:70%;
position:relative;
float:right;
}
#cmdSave
{
position:relative;
float:left;
top:50px;
left:-177px;
}
#lblStatus
{
position:relative;
float:left;
left:-170px;
top:53px;
color:red;
}
#useraccessradiobuttons
{
width:100%;
position:relative;
}
#newpassword
{
display:none;
position:relative;
top:22px;
}
#newpasswordrepeat
{
display:none;
position:relative;
top:22px;
}
When some users are browsing to this page the Save button is not appearing. I first came across this issue and released that Compatibility mode was turned on, when I turned it off the issue disappeared. This was fine, I instructed users to ensure that compatibility mode was off.
However now some users are reporting that the button is not appearing, even when compatibility mode is off. Users are using IE8.
I know there is a meta tag that can force the browser to emulate IE7/8/9, is this the way I should go, and if so, which of these versions should I be using based on the code above? It can be assumed that only IE will be used
Thanks in advance,
Neil
EDIT
Based on the answer given below I modified my stylesheet as follows:
body
{
background-color:#EAF3FF;
font-family:Tahoma;
font-size:11px;
padding-top: 5px;
padding-left:5px;
}
input
{
font-family:Tahoma;
font-size:11px;
}
#useraccessradiobuttons
{
width:60%;
display:inline;
}
#content
{
width:350px;
padding-bottom:10px;
}
#username
{
padding-bottom:7px;
}
#newpassword
{
padding-bottom:4px;
}
#passwordchange
{
padding-bottom:7px;
}
#access
{
width:100%;
padding-bottom:7px;
}
.label
{
float:left;
width:30%;
}
.radiobutton
{
padding-right:30px;
}
.link
{
width:50%;
height:5px;
color:blue;
text-decoration:underline;
}
.textbox
{
width:60%;
}
#cmdSave
{
width:60px;
}
#lblStatus
{
color:red;
}
#useraccessradiobuttons
{
display:inline;
}
#newpassword
{
display:none;
}
#newpasswordrepeat
{
display:none;
}
You seem to have a lot of unnecessary styling applied. The problem seems to be the
left:-177px;
on the #cmdSave.
However, a lot more of your styling can be removed to whilst keeping the same layout http://jsfiddle.net/jfsw4/6/
Then you can format more with margins and padding.

css position relative to the image

I am trying to align a text Email and textbox for it on top of an image at a specific location. I want the position to be fixed, no matter what size the screen is. Here is my html code:
<html>
<head>
<style type="text/css">
#container {
background-color:blue;
}
#content {
background: url('images/orange.jpg') no-repeat center top;
}
#c_main {
color: yellow;
}
#c_email {
position:absolute;
top:200px;
left:410px;
color: #FFFFFF;
font-size: 15px;
}
#c_emailbox1 {
position:absolute;
top:200px;
left:480px;
}
#c_emailbox2 {
position:absolute;
top:200px;
left:620px;
color: white;
font-size: 12px;
}
input {
border:0;
}
.email_textbox1 {
width:130px;
background-image:url('images/text_bg.jpg');
background-repeat:no-repeat;
}
.email_textbox2 {
color: #FFFFFF;
font-size: 11px;
width:130px;
background-image:url('images/text_bg.jpg');
background-repeat:no-repeat;
}
</style>
</head>
<body>
<div id="container">
<div id="content" style="height:1000px;left:0px;border:1px solid red;position:relative" >
<div style="height:100px;width:200px;border:1px solid red;position:absolute;top:250px;left:0px">
<h4> CREATE A USERNAME AND PASSWORD </h4>
</div>
<div id="c_email">
Email
</div>
<div id="c_emailbox1">
<input type="textbox" id="email1" border="0" class="email_textbox1">
</div>
<div id="c_emailbox2">
<input type="text" id ="email" value="Confirm Email Address" class="email_textbox2" onfocus="if
(this.value==this.defaultValue) this.value='';">
</div>
</div>
</div>
</body>
</html>
I cannot get it to align relative to the image. The text and textbox are misplaced when seen in a larger screen or if zoomed in and out. Suggestion please.
See my sample code. This is working. Change the height of parent div, the child always stays at bottom:
<div style="height:300px;border:1px solid red;position:relative">
<div style="height:100px;width:20px;border:1px solid red;position:absolute;bottom:0px">
</div>
</div>
If you want them always to the top of the text box. Make the parent control as relative.
The box or anything which you want to maintain constant distance make it absolute position
.Container {
position:relative
}
.child{
position:absolute
bottom:0px; // how much u wants to maintain..from the element
}

Resources