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.
Related
Trying to create a basic website layout for a course (Odin Project). However I noticed that their website design has a perfect box shadow with no light gap. Where as my design no matter how much I try to mess with the box shadow property settings seems to have a small 1-2px gap between the box shadow and input fields. This is very noticeable and sort of ruins the design. I am a novice at CSS and was hoping someone more experienced could direct me to a good solution.
.form-flex-container {
display: flex;
flex-direction: column;
margin-bottom: 40px;
}
input {
width: 215px;
height: 20px;
border-radius: 3px;
border: 1.5px solid #e5e7eb;
}
input[type="text"] {
padding-left: 9px;
}
input:focus {
outline-color: #4a6ed6;
border: none;
box-shadow: 2px 2px 5px #bebebe;
}
label {
display: inline-block;
font-size: 10px;
font-weight: 600;
letter-spacing: 1.5px;
text-transform: uppercase;
color: #2e3a4b;
margin-bottom: 3px;
/* margin-left: 2px; */
/* float: left; */
}
<form action="post">
<div class="form-row-1">
<div class="form-flex-container">
<label for="first-name">First Name</label>
<input type="text" name="first-name" id="first-name" />
</div>
<div class="form-flex-container">
<label for="last-name">Last Name</label>
<input type="text" name="last-name" id="last-name" />
</div>
</div>
<div class="form-row-2">
<div class="form-flex-container">
<label for="email">Email</label>
<input type="text" name="email" id="email" />
</div>
<div class="form-flex-container">
<label for="phone-number">Phone Number</label>
<input type="text" name="phone-number" id="phone-number" />
</div>
</div>
<div class="form-row-3">
<div class="form-flex-container">
<label for="password">Password</label>
<input type="text" name="password" id="password" />
</div>
<div class="form-flex-container">
<label for="confirm-password">Confirm Password</label>
<input type="text" name="confirm-password" id="confirm-password" />
</div>
</div>
</form>
I darkened the box shadow so you could see the gap more clearly.
So I discovered what was wrong. Apparently for some reason when I used the property outline-width and outline-color it wasn't actually targeting the outline under the input:focus selector. I had to use the shorthand outline: 1px solid #4a6ed6; to get rid of the gap. So now it works.
See outline property from MDN docs.
Instead of using border: none you can set it to 1.5px solid #4a6ed6 and remove the outline :
input {
width: 215px;
height: 20px;
border-radius: 3px;
border: 1.5px solid #e5e7eb;
}
input:focus {
// outline-color: #4a6ed6;
outline: none;
border: 1.5px solid #4a6ed6;
box-shadow: 2px 2px 5px #bebebe;
}
<form action="post">
<div class="form-row-1">
<div class="form-flex-container">
<input type="text" name="first-name" id="first-name" />
</div>
</div>
</form>
I want this form fields just like the red line in this picture https://i.stack.imgur.com/gbvDs.png
input,
select,
textarea {
width: 20%;
padding: 12px;
border: 1px solid #ccc;
box-sizing: border-box;
margin-left: 20px;
}
label {
padding: 12px 12px 12px 0;
display: inline-block;
}
.container {
/* the form is inside this container */
padding: 20px;
margin: 20px;
overflow: auto;
text-align: center;
}
<div class="container">
<form method="post" enctype="multipart/form-data" id="form">
<label for="id_image1">profile picture</label>
<input type="file" name="image1" accept="image/*" required id="id_image1" />
<label for="id_image2">cover picture</label>
<input type="file" name="image2" accept="image/*" required id="id_image2" />
<label for="id_tag">Name:</label> <input type="text" name="tag" maxlength="50" required id="id_tag" />
<button type="submit" class="button">Upload</button>
</form>
</div>
You can accomplish this with CSS Grid and a little padding.
.wrap,
.field-container {
display: inline-grid;
}
.field-container {
grid-template-columns: 1fr auto;
padding-bottom: 0.5rem;
}
.field-container label {
padding-right: 2rem;
text-align: right;
}
<div class="wrap">
<div class="field-container">
<label for="profilePic">Profile picture</label>
<input type="text" id="profilePic">
</div>
<div class="field-container">
<label for="coverPic">Cover picture</label>
<input type="text" id="coverPic">
</div>
<div class="field-container">
<label for="name">Name</label>
<input type="text" id="name">
</div>
</div>
jsFiddle
I changed your code this way, please check if it is suits what you desire:
<div class="container">
<form method="post" enctype="multipart/form-data" id="form">
<div class="rows">
<div class="column">
<label for="id_image1">profile picture</label>
<input type="file" name="image1" accept="image/*" required id="id_image1" />
</div>
<div class="column">
<label for="id_image2">cover picture</label>
<input type="file" name="image2" accept="image/*" required id="id_image2" />
</div>
<div class="column">
<label for="id_tag">Name:</label> <input type="text" name="tag" maxlength="50" required id="id_tag" />
<button type="submit" class="button">Upload</button>
</div>
</div>
</form>
</div>
<style>
input,
select,
textarea {
width: 55%;
padding: 12px;
border: 1px solid #ccc;
box-sizing: border-box;
margin-left: 20px;
}
label {
width:30%;
float:left;
}
#form{
width:100%;
}
.container {
width:40%;
margin:auto;
}
.rows{
width:100%;
display:block;
}
.column{
width:100%;
display:inline-block;
}
</style>
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>
I would like to replace the default view of radio buttons by customizing it. So, I would like to toggle between two images(as I am not good with css3 animations, so i chose to do the job with images).
So for check state I would like to display (check.png):
And when the radio button is unchecked I would like to display (uncheck.png):
HTML CODE:
currently I am using the following bootstrap markup:
<section class="lineHeight">
<div class="radio">
<label>
<input type="radio" name="auditTool" id="optionsRadios1" value="option1">
<span class="outer"><span class="inner"></span></span>Large
</label>
</div>
</section>
CSS:
.lineHeight{
line-height:56px;
}
.lineHeight .radio input[type=radio]{
position: absolute;
top: 50%;
margin-top: -6px;
margin-left: -20px;
}
You can hide the native radio and display a custom one with CSS.
input[type=radio] {
display: none;
}
input[type=radio] + label:before {
content: '';
display: inline-block;
border: 2px solid #0F81D5;
height: 12px;
width: 12px;
border-radius: 50%;
}
label:hover:before {
box-shadow: inset 0 0 5px orange;
}
input[type=radio]:checked + label:before {
border-width: 5px;
height: 6px;
width: 6px;
}
<div>
<input type="radio" name="radio" id="radio1" />
<label for="radio1">Foo</label>
</div>
<div>
<input type="radio" name="radio" id="radio2" />
<label for="radio2">Bar</label>
</div>
<div>
<input type="radio" name="radio" id="radio3" />
<label for="radio3">Baz</label>
</div>
input[type=radio].css-checkbox {
position: absolute;
z-index: -1000;
left: -1000px;
overflow: hidden;
clip: rect(0 0 0 0);
height: 1px;
width: 1px;
margin: -1px;
padding: 0;
border: 0;
}
input[type=radio].css-checkbox + label.css-label {
padding-left: 23px;
height: 18px;
display: inline-block;
line-height: 18px;
background-repeat: no-repeat;
background-position: 0 0;
font-size: 18px;
vertical-align: middle;
cursor: pointer;
}
input[type=radio].css-checkbox:checked + label.css-label {
background-position: 0 -18px;
}
label.css-label {
background-image: url(http://csscheckbox.com/checkboxes/u/csscheckbox_67c83917465692304d237c7e9e0533ca.png);
-webkit-touch-callout: none;
-webkit-user-select: none;
-khtml-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<title>CSS Checkbox Demo from CSSCheckbox.com</title>
<link rel="stylesheet" href="style.css" />
<style type="text/css">
/*this is just to organize the demo checkboxes*/
label {
margin-right: 20px;
}
</style>
</head>
<body>
<h1 style="margin:0; margin-top:10px; padding:0; padding-left:25px; padding-bottom:10px; font-family:sans-serif;">CSS Checkboxes!</h1>
<div style="background:#444; color:#fafafa; padding:10px;">
<h3>Dark Background</h3>
<table>
<tr>
<td>
<input type="radio" name="radiog_lite" id="radio1" class="css-checkbox" />
<label for="radio1" class="css-label radGroup1">Option 1</label>
</td>
<td>
<input type="radio" name="radiog_lite" id="radio2" class="css-checkbox" checked="checked" />
<label for="radio2" class="css-label radGroup1">Option 2</label>
</td>
<td>
<input type="radio" name="radiog_lite" id="radio3" class="css-checkbox" />
<label for="radio3" class="css-label radGroup1">Option 1</label>
</td>
</tr>
</table>
</div>
<div style="background:#fafafa; color:#222; padding:10px;">
<h3>Light Background</h3>
<table>
<tr>
<td>
<input type="radio" name="radiog_dark" id="radio4" class="css-checkbox" />
<label for="radio4" class="css-label radGroup2">Option 1</label>
</td>
<td>
<input type="radio" name="radiog_dark" id="radio5" class="css-checkbox" checked="checked" />
<label for="radio5" class="css-label radGroup2">Option 2</label>
</td>
<td>
<input type="radio" name="radiog_dark" id="radio6" class="css-checkbox" />
<label for="radio6" class="css-label radGroup2">Option 1</label>
</td>
</tr>
</table>
</div>
<p style="padding-left:25px;">Radio Button generated by CSS Checkbox
</p>
</body>
</html>
Reference: http://www.csscheckbox.com/radio-buttons/0/
im using twitter bootstrap 3 and trying to center login form.
Example is here http://jsfiddle.net/0y848kf8/.
form is like this
<div id="loginContainer" class="container">
<h2>Sign in</h2>
<form action="/www/sign/in" method="post" class="form-horizontal" id="frm-signInForm">
<div class="form-group"><label for="frm-signInForm-username" class=" control-label col-sm-2">Username:</label>
<div class="col-sm-5"><input type="text" name="username" id="frm-signInForm-username" required="" data-nette-rules="[{"op":":filled","msg":"Please enter your username."}]" value="" class="form-control"></div>
</div>
<div class="form-group"><label for="frm-signInForm-password" class=" control-label col-sm-2">Password:</label>
<div class="col-sm-5"><input type="password" name="password" id="frm-signInForm-password" required="" data-nette-rules="[{"op":":filled","msg":"Please enter your password."}]" class="form-control"></div>
</div>
<div class="form-group">
<div class="col-sm-offset-2 col-sm-5">
<input type="submit" name="send" id="frm-signInForm-send" value="Sign in" class="btn btn-default">
</div>
</div>
<div><input type="hidden" name="do" value="signInForm-submit"></div>
</form>
</div>
And im curious why pagination-center class not working on loginContainer and why form-groups have such big width. I thought that centering with bootstrap will be easy, but i must make some mistake.
Here is a basic use scenario to center the form using css media queries. You originally had div id="container-fluid" (you'll want class not id) which is a full-width container so you'll want div class="container" to utilize the bootstrap default css.
Let me know if this helps at all.
input[type="text"],
input[type="password"],
.form-control {
box-shadow: none;
padding: 4px 0px 0px 10px;
height: 40px;
width: 100%;
font-size: 16px;
color: #33342e;
border: 1px solid #1c1c1c;
border-radius: 1px;
line-height: 100%;
-webkit-border-radius: 0;
border-radius: 0;
-webkit-box-shadow: none;
box-shadow: none;
-webkit-appearance: none;
appearance: none;
}
#contact-form {
padding: 15px 350px;
color: #1c1c1c;
font-size: 16px;
}
.btn-submit {
color: #fff;
background-color: #1c1c1c;
border-color: #fff;
width: 100%;
height: 45px;
font-size: 20px;
font-weight: 500;
margin: 5px 0px;
}
.btn-submit:hover {
color: #F00;
background-color: #FFF;
border: 2px solid #1c1c1c;
}
#media (max-width: 992px) {
#contact-form {
padding: 15px 50px;
}
}
#media (max-width: 480px) {
#contact-form {
padding: 15px 0px;
}
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet" />
<div class="container">
<form id="contact-form" name="contact-form" class="contact-form">
<fieldset>
<div class="row">
<div class="col-lg-12 form-group">
<h2>Sign In</h2>
<label for="user">Username</label>
<input class="form-control" type="text" value="" name="user" placeholder="Username" aria-required="true" />
</div>
<div class="col-lg-12 form-group">
<label for="Password">Password</label>
<input class="fom-control" type="text" value="" name="password" placeholder="Password" aria-required="true" />
</div>
<div class="col-lg-12 form-group">
<input type="submit" class="btn btn-submit" />
</div>
</div>
<!--end row-->
</fieldset>
</form>
</div>
Try this
http://jsfiddle.net/scaisEdge/bhk7n3ar/
<div id="loginContainer" class="container">
<h2 class="text-center">Sign in</h2>
and change width of the field