CSS styling for checkbox in JQuery Mobile (extra checkbox) - css

Having trouble obtaining the correct css to create a check list in jqm. with the help of Make checkbox larger in Jquery Mobile I was able to get a larger checkbox but the results created new checkbox in undesired location? my label elements seem to be creating extra checkbox where my html doesn't have one. see JSFiddle example.
outer label tag is producing a checkbox and css sizing desired to make box larger is only applied to outer label box (the one that shouldn't even be there).
HTML
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.2.0/jquery.mobile-1.2.0.min.css" />
<script src="http://code.jquery.com/jquery-1.8.3.min.js"></script>
<script src="http://code.jquery.com/mobile/1.2.0/jquery.mobile-1.2.0.min.js"></script>
<div data-role="page" data-theme="b" id="acs">
<div data-role="header">
<h2>Key Performance Indicators</h2>
</div>
<div data-role="content">
<ul data-role="listview" data-theme="b">
<li>
<h1>Assess Cardiac Risk Factors</h1>
<label>
<input type="checkbox" name="checkbox-2b" id="checkbox-2b" data-theme="b"/>
<label for="checkbox-2b">
<label>
<h3>Age</h3>
</label>
</label>
</label>
<label>
<input type="checkbox" name="checkbox-2b" id="checkbox-2b" data-theme="b"/>
<label for="checkbox-2b">
<label>
<h3>Diabetes</h3>
</label>
</label>
</label>
</li>
</ul>
</div>
<div data-role="footer">
<div data-role="navbar">
</div>
</div>
<div>
<h4>My Footer</h4>
</div>
</div>
CSS
#checkbox-2b {
-ms-transform: scale(6); /* IE */
-moz-transform: scale(6); /* FF */
-webkit-transform: scale(6); /* Safari and Chrome */
-o-transform: scale(6); /* Opera */
padding: 10px;
}

I have updated your fiddle -> http://jsfiddle.net/xxdrf87q/7/
Looking to the documentation the right way for doing a checkbox with it's label is this:
<label>
<input type="checkbox" name="checkbox-0 ">Check me
</label>
So I changed this part:
<label>
<input type="checkbox" name="checkbox-2b" id="checkbox-2b" data-theme="b"/> Age
</label>
<label>
<input type="checkbox" name="checkbox-2b" id="checkbox-2b" data-theme="b"/> Diabetes
</label>

Thanks to jcarrera for the fix, to clarify my final issue here was the resolution to the multiple check boxes unsolicited: The css needed to add z-index: 2; to apply to top layer checkbox and remove id from the label elements. Cleaned up extra code by removing extra label tags not needed.
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.2.0/jquery.mobile-1.2.0.min.css" />
<script src="http://code.jquery.com/jquery-1.8.3.min.js"></script>
<script src="http://code.jquery.com/mobile/1.2.0/jquery.mobile-1.2.0.min.js"></script>
<div data-role="page" data-theme="b" id="acs">
<div data-role="header">
<h2>Key Performance Indicators</h2>
</div>
<div data-role="content">
<ul data-role="listview" data-split-icon="gear" data-theme="c">
<h1>Assess Cardiac Risk Factors</h1>
<label>
<input type="checkbox" name="checkbox-2b" id="checkbox-2b" data-theme="c"/>
<h3>Age</h3>
</label>
<label>
<input type="checkbox" name="checkbox-2b" id="checkbox-2b" data-theme="c"/>
<h3>Diabetes</h3>
</label>
</ul>
</div>
<div data-role="footer">
<div data-role="navbar">
</div>
<h4>John Doe</h4>
</div>
</div>

Related

Adding a :checked pseudo class to an embedded mailchimp form

First of all I'm not really a web developer, so bear with me.
I'm trying to embed a mailchimp signup form on my site. I have a set check-boxes that I'd like to keep hidden unless a certain radio button is selected.
<!-- Begin MailChimp Signup Form -->
<link href="//cdn-images.mailchimp.com/embedcode/classic-10_7.css" rel="stylesheet" type="text/css">
<style type="text/css">
.reveal{
display: none !important;
}
#radio-2:checked ~ .reveal {
display: inline;
}
</style>
<div id="mc_embed_signup">
<form action="n/a" method="post" id="mc-embedded-subscribe-form" name="mc-embedded-subscribe-form" class="validate" target="_blank" novalidate>
<div id="mc_embed_signup_scroll">
<div class="mc-field-group input-group">
<strong>Radio Buttons</strong>
<ul>
<li><input type="radio" id="radio-1" value="Radio 1" name="MMERGE6" id="mce-MMERGE6-0"><label for="mce-MMERGE6-0">Radio 1</label></li>
<li><input type="radio" id="radio-2" value="Part Time" name="MMERGE6" id="mce-MMERGE6-1"><label for="mce-MMERGE6-1">Part Time</label></li>
</ul>
</div>
<div class="mc-field-group input-group reveal">
<ul>
<li><input type="checkbox" value="1" name="group[18657][1]" id="mce-group[18657]-18657-0"><label for="mce-group[18657]-18657-0">1</label></li>
<li><input type="checkbox" value="2" name="group[18657][2]" id="mce-group[18657]-18657-1"><label for="mce-group[18657]-18657-1">2</label></li>
<li><input type="checkbox" value="4" name="group[18657][4]" id="mce-group[18657]-18657-2"><label for="mce-group[18657]-18657-2">3</label></li>
<li><input type="checkbox" value="8" name="group[18657][8]" id="mce-group[18657]-18657-3"><label for="mce-group[18657]-18657-3">4</label></li>
</ul>
</div>
<div id="mce-responses" class="clear">
<div class="response" id="mce-error-response" style="display:none"></div>
<div class="response" id="mce-success-response" style="display:none"></div>
</div> <!-- real people should not fill this in and expect good things - do not remove this or risk form bot signups-->
<div style="position: absolute; left: -5000px;" aria-hidden="true"><input type="text" name="b_e7f52c90ee3d55370f2c41bac_8ea8200d35" tabindex="-1" value=""></div>
<div class="clear"><input type="submit" value="Subscribe" name="subscribe" id="mc-embedded-subscribe" class="button"></div>
</div>
</form>
</div>
<script type='text/javascript' src='//s3.amazonaws.com/downloads.mailchimp.com/js/mc-validate.js'></script><script type='text/javascript'>(function($) {window.fnames = new Array(); window.ftypes = new Array();fnames[0]='EMAIL';ftypes[0]='email';fnames[1]='FNAME';ftypes[1]='text';fnames[2]='LNAME';ftypes[2]='text';fnames[4]='MMERGE4';ftypes[4]='phone';fnames[6]='MMERGE6';ftypes[6]='radio';}(jQuery));var $mcj = jQuery.noConflict(true);</script>
<!--End mc_embed_signup-->
I want the set of checkboxes here to only reveal when the second radio button is selected.
I can get :checked to work when I write my own form, but I can't seem to get it to work within an embedded mailchimp form, and I can't figure out why. Does anyone have any ideas?
There are a few issues here:
A style with the !important rule cannot be overridden with another style that doesn't include !important. You can just remove it from your first style to resolve this.
The ~ sibling CSS selector locates elements with the same parent. Because the radio and .reveal elements don't share the same parent, it doesn't display the .reveal element.
The radio buttons shouldn't have two id attributes. Only the second id is set when more than one exists.
In order to make the sibling selector work, you can remove the <ul> and <li> elements from the radio buttons, and add line breaks before them so they're still on separate lines. Also put the .reveal class <div> inside the first .mc-field-group one. This will make the radio buttons have the same parent as the hidden element.
Here's what the updated code looks like:
<!-- Begin MailChimp Signup Form -->
<link href="//cdn-images.mailchimp.com/embedcode/classic-10_7.css" rel="stylesheet" type="text/css">
<style type="text/css">
.reveal {
display: none;
}
#mce-MMERGE6-1:checked ~ .reveal {
display: inline;
}
</style>
<div id="mc_embed_signup">
<form action="n/a" method="post" id="mc-embedded-subscribe-form" name="mc-embedded-subscribe-form" class="validate" target="_blank" novalidate>
<div id="mc_embed_signup_scroll">
<div class="mc-field-group input-group">
<strong>Radio Buttons</strong>
<br>
<input type="radio" value="Radio 1" name="MMERGE6" id="mce-MMERGE6-0"><label for="mce-MMERGE6-0">Radio 1</label>
<br>
<input type="radio" value="Part Time" name="MMERGE6" id="mce-MMERGE6-1"><label for="mce-MMERGE6-1">Part Time</label>
<div class="reveal">
<ul>
<li><input type="checkbox" value="1" name="group[18657][1]" id="mce-group[18657]-18657-0"><label for="mce-group[18657]-18657-0">1</label></li>
<li><input type="checkbox" value="2" name="group[18657][2]" id="mce-group[18657]-18657-1"><label for="mce-group[18657]-18657-1">2</label></li>
<li><input type="checkbox" value="4" name="group[18657][4]" id="mce-group[18657]-18657-2"><label for="mce-group[18657]-18657-2">3</label></li>
<li><input type="checkbox" value="8" name="group[18657][8]" id="mce-group[18657]-18657-3"><label for="mce-group[18657]-18657-3">4</label></li>
</ul>
</div>
</div>
<div id="mce-responses" class="clear">
<div class="response" id="mce-error-response" style="display:none"></div>
<div class="response" id="mce-success-response" style="display:none"></div>
</div>
<!-- real people should not fill this in and expect good things - do not remove this or risk form bot signups-->
<div style="position: absolute; left: -5000px;" aria-hidden="true"><input type="text" name="b_e7f52c90ee3d55370f2c41bac_8ea8200d35" tabindex="-1" value=""></div>
<div class="clear"><input type="submit" value="Subscribe" name="subscribe" id="mc-embedded-subscribe" class="button"></div>
</div>
</form>
</div>
<script type='text/javascript' src='//s3.amazonaws.com/downloads.mailchimp.com/js/mc-validate.js'></script><script type='text/javascript'>(function($) {window.fnames = new Array(); window.ftypes = new Array();fnames[0]='EMAIL';ftypes[0]='email';fnames[1]='FNAME';ftypes[1]='text';fnames[2]='LNAME';ftypes[2]='text';fnames[4]='MMERGE4';ftypes[4]='phone';fnames[6]='MMERGE6';ftypes[6]='radio';}(jQuery));var $mcj = jQuery.noConflict(true);</script>
<!--End mc_embed_signup-->

How do I change the Mailchimp subscribe button color using inline CSS?

How can I use inline css to change the button and hover colors in the embedded Mailchimp form on my site Homeschool With Love? I would like the background color to be #0A99AA and the hover color to be #d40000. It is a Wordpress.org site. Can you please show what code I should insert and where I should insert it? Thanks. Here's the code I have right now:
<div style="border-style: solid; border-width: 2px; border-color: #0A99AA;">
<!-- Begin MailChimp Signup Form -->
<link href="//cdn-images.mailchimp.com/embedcode/classic-10_7.css" rel="stylesheet" type="text/css">
<style type="text/css">
#mc_embed_signup{background:#fff; clear:left; font:14px Helvetica,Arial,sans-serif; }
/* Add your own MailChimp form style overrides in your site stylesheet or in this style block.
We recommend moving this block and the preceding CSS link to the HEAD of your HTML file. */
</style>
<div id="mc_embed_signup">
<form action="//homeschoolwithlove.us13.list-manage.com/subscribe/post?u=74d56fdb848e8be499cc4df0e&id=a119f30caa" method="post" id="mc-embedded-subscribe-form" name="mc-embedded-subscribe-form" class="validate" target="_blank" novalidate>
<div id="mc_embed_signup_scroll">
<div style="text-align: center; color: #d40000; font-size: 120%; padding-right: 10px; padding-left: 10 px;">
<h3>Sign up for the Homeschool With Love Newsletter and get the Angel Learning Resource Pack FREE</h3>
</div>
<div class="indicates-required"><span class="asterisk">*</span> indicates required</div>
<div class="mc-field-group">
<label for="mce-EMAIL">Email Address <span class="asterisk">*</span>
</label>
<input type="email" value="" name="EMAIL" class="required email" id="mce-EMAIL">
</div>
<div class="mc-field-group">
<label for="mce-FNAME">First Name <span class="asterisk">*</span>
</label>
<input type="text" value="" name="FNAME" class="required" id="mce-FNAME">
</div>
<div class="mc-field-group">
<label for="mce-LNAME">Last Name </label>
<input type="text" value="" name="LNAME" class="" id="mce-LNAME">
</div>
<div id="mce-responses" class="clear">
<div class="response" id="mce-error-response" style="display:none">
</div>
<div class="response" id="mce-success-response" style="display:none"></div>
</div> <!-- real people should not fill this in and expect good things - do not remove this or risk form bot signups-->
<div style="position: absolute; left: -5000px;" aria-hidden="true">
<input type="text" name="b_74d56fdb848e8be499cc4df0e_a119f30caa" tabindex="-1" value=""></div>
<div class="clear"><input type="submit" value="Subscribe" name="subscribe" id="mc-embedded-subscribe" class="button"></div>
</div>
</form>
</div>
<!--End mc_embed_signup-->
</div>
add these two lines immediately after the #mc_embed_signup line:
#mc-embedded-subscribe { background-color: #0a99a !important; }
#mc-embedded-subscribe:hover { background-color: #d40000 !important; }

How to get radiobutton with text on the same line?

Searched this place and tried the options suggested on different answeres, such as "display: block", float:left etc, but I cant manage to get them on the same line.
Here is the code the plugin have:
<div class="gift-certificate sc_info_box">
<h3>Mottagare av presentkort</h3>
<div class="gift-certificate-show-form">
<p>Vem vill du skicka ditt presentkort till?</p>
<ul class="show_hide_list" style="list-style-type: none;">
<li><input type="radio" id="hide_form" name="is_gift" value="no" checked="checked"> <label for="hide_form">Till mig!</label></li>
<li>
<input type="radio" id="show_form" name="is_gift" value="yes"> <label for="show_form">Till nĂ¥gon annan!</label>
<ul class="single_multi_list" style="list-style-type: none;">
<li><input type="radio" id="send_to_one" name="sc_send_to" value="one" checked="checked"> <label for="send_to_one">Send to one person</label>
<input type="radio" id="send_to_many" name="sc_send_to" value="many"> <label for="send_to_many">Send to different people</label></li>
</ul>
</li>
</ul>
</div>
<div class="gift-certificate-receiver-detail-form">
<div class="clear"></div>
<div id="gift-certificate-receiver-form-multi">
<div class="form_table">
<div class="email_amount">
<div class="amount"><p class="coupon_amount_label"><span class="amount">1,500 kr</span></p></div>
<div class="email"><input class="gift_receiver_email" type="text" placeholder="Email address..." name="gift_receiver_email[9216][]" value=""></div>
</div>
<div class="message_row">
<div class="sc_message"><textarea placeholder="Message..." class="gift_receiver_message" name="gift_receiver_message[9216][]" cols="50" rows="5"></textarea></div>
</div>
</div>
</div>
<div id="gift-certificate-receiver-form-single">
<div class="form_table">
<div class="email_amount">
<div class="amount"><p class="coupon_amount_label"><span class="amount">1,500 kr</span></p></div>
<div class="email"><input class="gift_receiver_email" type="text" placeholder="Mottagarens E-mail..." name="gift_receiver_email[0][0]" value=""></div>
</div>
<div class="message_row">
<div class="message"><textarea placeholder="Ditt meddelande..." class="gift_receiver_message" name="gift_receiver_message[0][0]" cols="50" rows="5"></textarea></div>
</div>
</div>
</div>
</div></div>
This displays:
So question is: How would I go about to get the text next to its button on the 2 rows? I need to work on mobiles aswell if possible.
Make your CSS:
li input[type="radio"], li label {
display: inline-block;
}
Their default layout is display: block which puts them on their own line regardless that you have placed them within one tag.

changing the default list colour of jquery mobile using css

I have an html page given below
<body>
<div data-role="page" id="home">
<div data-role="header" data-position="fixed">
</div>
<div data-role="content">
<div class="content-primary">
<form id="frm1">
<ul data-role="listview">
<li data-role="fieldcontain">
<label for="Name">name:</label>
<input type="text" Name="Name" id="Name" value="" />
</li>
<li data-role="fieldcontain">
<label for="No">no:</label>
<input type="text" No="No" id="No" value="" />
</li>
<li data-role="fieldcontain">
<label for="countryName">Country name:</label>
<input type="text" countryName="countryName" id="countryName" value="" />
</li>
<li data-role="fieldcontain">
<label for="stateName">State name:</label>
<input type="text" stateName="stateName" id="stateName" value="" />
</li>
<li data-role="fieldcontain">
<label for="cityName">City name:</label>
<input type="text" cityName="cityName" id="cityName" value="" />
</li>
</form>
</div>
</div>
</body>
and i am using the following jquery 1.3.2 links displayed in the link given
http://jquerymobile.com/download/
and i have css file given below
.ui-body-c { background:#FFFFFF !important; }
.ui-page .ui-header {
background:#0B0B3B !important;
}
.ui-page .ui-footer {
background:#0B0B3B !important;
}
When i am using the above code the list which is displayed contains grey color.
how will i get white color instead grey to the list displayed.
Thanks in advance
I can't actually test this but I have noticed oddities like this before when a css rule is defined as background-color: and you try to override with just background:
Try changing your rule to say background-color: instead. Also, if you can help it, stay clear of !important unless you're sure it's what you need. It can be a real pain when your css gets more complicated.
All you need is to set background-color rule to .ul-body
.ui-body{
background-color:#FFF;
}
Don't use !improtant, Keep it as a last resource.
Note: In case some other list might contain a class named ui-body, but you can give parent ID or class as selector to your custom class .ui-body
#Parent .ui-body{
}
.Parent .ui-body{
}
fiddle

Trouble with content overlapping horizontal form using responsive Twitter Bootstrap

I have spent more time than I ever care to admit trying to fix this stupid bug. I have a form that displays to the left of some content. It looks okay on a wide and narrow screen, but on a tablet width (it overlays between 770 and 950 or so) the content to the right overlaps the form fields.
Am I missing something in my markup to use Twitter Bootstrap properly or do I need to add some custom styles using breakpoints to fix it? It appears that the fixed pixel width is causing the issue defined in bootstrap.css. Shouldn't these width properties use % since I'm using a fluid responsive layout?
<div class="container-narrow">
<div class="content">
<div class="row-fluid">
<div class="span5">
<form class="form-horizontal" id="applies-Step1-form" action="/" method="post">
<div class="control-group">
<label class="control-label required" for="Step1_email">Email <span class="required">*</span></label>
<div class="controls">
<input size="60" maxlength="255" name="Step1[email]" id="Step1_email" type="text" />
</div>
</div>
<div class="control-group">
<label class="control-label required" for="Step1_home_zip">Home Zip <span class="required">*</span></label>
<div class="controls">
<input size="5" maxlength="5" name="Step1[home_zip]" id="Step1_home_zip" type="text" />
</div>
</div>
</form>
</div>
<div class="span7">
<div class="promo-btm">
<h2>Heading 2</h2>
<ul class="checks">
<li>Bullet One</li>
<li>Bullet Two</li>
</ul>
</div>
</div>
</div>
</div>
</div>
See the attached screenshot for the bug or you can reproduce it yourself using my fiddle.
If someone could help point out a way to fix this I would be extremely appreciative!
Just add a width to your input elements so they can adapt responsively with all of your screen sizes. You can use something like .span12 as a width on your input elements and that should fix the issue:
HTML
<div class="container-narrow">
<div class="content">
<div class="row-fluid">
<div class="span5">
<form class="form-horizontal" id="applies-Step1-form" action="/" method="post">
<div class="control-group">
<label class="control-label required" for="Step1_email">Email <span class="required">*</span></label>
<div class="controls">
<input class="span12" size="60" maxlength="255" name="Step1[email]" id="Step1_email" type="text" />
</div>
</div>
<div class="control-group">
<label class="control-label required" for="Step1_home_zip">Home Zip <span class="required">*</span></label>
<div class="controls">
<input class="span12" size="5" maxlength="5" name="Step1[home_zip]" id="Step1_home_zip" type="text" />
</div>
</div>
</form>
</div>
<div class="span7">
<h2>Heading 2</h2>
<ul class="checks">
<li>Bullet One</li>
</ul>
</div>
</div>
</div>
</div>
Demo: http://jsfiddle.net/yR7Ap/18/
The other posts have pinpointed the root cause of the problem, that your form is too wide for the span5 div with the default bootstrap css
It's not too difficult to make it fit though. See if this helps : http://jsfiddle.net/panchroma/FXXaZ/
I have tightened up your form with this CSS:
/* pull control label left */
.form-horizontal .control-label {
width:70px; /* default 160 */
}
/* pull input box left */
.form-horizontal .controls {
margin-left: 90px; /* defaul 180 */
}
/* shorten input box */
input, textarea, .uneditable-input {
width: 180px; /* default 206 */
}
Good luck!
Your form is too wide for the .span5 column. Try adding this above:
<div class="row-fluid">
<div class="span5">hello</div>
<div class="span7">world</div>
</div>
and add the following style:
.row-fluid > div { outline: 5px solid green; }
and you'll see what I mean.

Resources