I have no way of explaining this better.
Please see this fiddle: https://jsfiddle.net/4vosLvxg/3/
<div class="col-md-12 " style="display: flex;">
<div class="checkbox">
<label class="tooltips">
<input type="checkbox"> Système d'avertissement de collision
et frein de secours automatique
</label>
</div>
<a class="tool-tip"></a>
</div>
The CSS is irelevant since I've tried all known combinations.
What I (my client) want(s) is to make the infobutton appear near the text (label) but not inside the label.
To reproduce the issue one must resize the window till the last word goes on a new line. Then he will see that the label's width won't be as long as the longest line.
Hours wasted: ~14
Any suggestion/hack will do.
EDIT:
This explains it better:
Here's what I think you are asking for. Please note the change in html markup:
.checkbox {
display: inline-block;
position: relative;
padding-left: 15px;
}
.checkbox input[type=checkbox] {
float: left;
margin-left: -15px;
}
.checkbox label {
text-align: justify;
display: inline-block;
}
.checkbox a.tool-tip {
width: 14px;
background: url("http://www.chromachklist.com/wp-content/uploads/2012/06/InfoButton0.png") right no-repeat;
padding: 10px;
position: absolute;
right: 0;
top: 0;
}
.tooltips a.tool-tip {
visibility: hidden;
position: initial;
float: right;
}
<div class="col-md-12 " style="display: flex;">
<div class="checkbox">
<a class="tool-tip"></a>
<label class="tooltips">
<a class="tool-tip"></a>
<input type="checkbox"> Système d'avertissement de collision et frein de secourssssssssss automatique
</label>
</div>
</div>
Related
I am trying to add text below an existing div id. How ever the white-space: pre-wrap; or adding html tags such as content:"\<br/> Lorem ipsome." does not move the text to the next line.
HTML and CSS part:
div.brand-amenity-value.economy.YV span.amenity-value:lang(en)::after {
margin-left: 0px;
white-space: pre-wrap;
content: '<p> (One date change free) </p>';
}
<div class="brand-amenity-value economy YV" style="height: 70px; background-color: #f2f5e6;">
<div><span class="spark-assistive-text">Yes</span></div>
<span class="amenity-value"><span data-translation="AED 100">AED 100</span></span></div>
Screen-shot of the text that needs to be on second line:
You don't need <p> or <br> tag. The pseudo-element ::after itself can be styled. In this case set display to block would work:
div.brand-amenity-value.economy.YV span.amenity-value::after {
margin-left: 0px;
white-space: pre-wrap;
content: '(One date change free)';
display: block;
}
<div class="brand-amenity-value economy YV" style="height: 70px; background-color: #f2f5e6;">
<div><span class="spark-assistive-text">Yes</span></div>
<span class="amenity-value"><span data-translation="AED 100">AED 100</span></span>
</div>
Or if this solution is not an option somehow, you can use \A to add a new line:
div.brand-amenity-value.economy.YV span.amenity-value::after {
margin-left: 0px;
white-space: pre-wrap;
content: '\A(One date change free)';
}
<div class="brand-amenity-value economy YV" style="height: 70px; background-color: #f2f5e6;">
<div><span class="spark-assistive-text">Yes</span></div>
<span class="amenity-value"><span data-translation="AED 100">AED 100</span></span>
</div>
Reference: https://www.w3.org/TR/CSS2/generate.html#content
You can consider position:absolute
div.brand-amenity-value.economy.YV span.amenity-value::after {
content: '(One date change free) ';
position:absolute;
top:100%;
left:0;
white-space:nowrap;
}
div.brand-amenity-value.economy.YV span.amenity-value{
position:relative;
display:inline-block;
}
<div class="brand-amenity-value economy YV" style="height: 70px; background-color: #f2f5e6;">
<div><span class="spark-assistive-text">Yes</span></div>
<span class="amenity-value"><span data-translation="AED 100">AED 100</span></span>
</div>
This my first question, so I hope that I ask it correctly.
Matthew Cain has created a great example of a fancy radio button using html and css which can be seen at https://www.templatemonster.com/blog/style-checkboxes-radio-buttons-css/. In it he uses this code:
body {
margin: 0;
padding: 0;
font-family: 'PT Sans', sans-serif;
font-size: 1.3em;
font-weight: bold;
color: #fff;
}
#first {
background-color: #4B4D65;
}
#second {
background-color: #FF8A66;
}
.section {
padding: 100px;
padding-left: 150px;
}
.section input[type="radio"],
.section input[type="checkbox"]{
display: none;
}
.container {
margin-bottom: 10px;
}
.container label {
position: relative;
}
/* Base styles for spans */
.container span::before,
.container span::after {
content: '';
position: absolute;
top: 0;
bottom: 0;
margin: auto;
}
/* Radio buttons */
.container span.radio:hover {
cursor: pointer;
}
.container span.radio::before {
left: -52px;
width: 45px;
height: 25px;
background-color: #A8AAC1;
border-radius: 50px;
}
.container span.radio::after {
left: -49px;
width: 17px;
height: 17px;
border-radius: 10px;
background-color: #6C788A;
transition: left .25s, background-color .25s;
}
input[type="radio"]:checked + label span.radio::after {
left: -27px;
background-color: #EBFF43;
}
<section id="first" class="section">
<div class="container">
<input type="radio" name="group1" id="radio-1">
<label for="radio-1"><span class="radio">Coffee</span></label>
</div>
<div class="container">
<input type="radio" name="group1" id="radio-2">
<label for="radio-2"><span class="radio">Tea</span></label>
</div>
<div class="container">
<input type="radio" name="group1" id="radio-3">
<label for="radio-3"><span class="radio">Cappuccino</span></label>
</div>
</section>
When I debug it in Chrome I see
<span class="radio"> == $0
::before
"Coffee"
::after
</span"
Here is my HTML:
<body class="my_PageBg" data-usepopupcontrols="no">
<div class="my_DesktopContainer my_temp_unselect" style="display: none;">
<div tabindex="1" class="container"
id="radio1" style="transform-origin: center 50%; left: 20px; top: 40px; width: 660px; height: 100px;
overflow: auto; position: absolute; z-index: 1; direction: ltr; transform: inherit; transform-style: preserve-3d;"
contenteditable="false">
<tbody>
<tr>
<td style="padding: 0px; white-space: nowrap;">
<label style="cursor: default;" onkeydown="onTreeLabelKeyDown(event)" for="radio10" name="radio1">
<input name="radio1" tabindex="1" id="radio10" onclick='OnResetDownChainControls("radio1",event)' type="radio" checked="" value="Value1"/>
Val1
</label>
</td>
</tr>
<tr>
<td style="padding: 0px; white-space: nowrap;">
<label style="cursor: default;" onkeydown="onTreeLabelKeyDown(event)" for="radio11" name="radio1">
<input name="radio1" tabindex="1" id="radio11" onclick='OnResetDownChainControls("radio1",event)' type="radio" value="Value2"/>
Val2
</label>
</td>
</tr>
<tr>
<td style="padding: 0px; white-space: nowrap;"><label style="cursor: default;" onkeydown="onTreeLabelKeyDown(event)" for="radio12" name="radio1">
<input name="radio1" tabindex="1" id="radio12" onclick='OnResetDownChainControls("radio1",event)' type="radio" value="Value3"/>
Val3
</label>
</td>
</tr>
</tbody>
I am trying to do the same to the Text "Val1", "Val2", "etc.
Please note that I can not change the html since it is coming from an external call.
What css selector can I use?
::after and ::before pseudo-elements do not apply to replaced-elements or void-elements.
But you can use a <span> to achieve the desired effect. Example:
.my-special-class:before {
content: '[before] ';
}
.my-special-class:after {
content: ' [after]';
}
.my-special-class:before,
.my-special-class:after {
color: red;
}
<span class="my-special-class">Val 1</span>
Obviously, you can name the class to whatever you want and change the selectors accordingly.
Note: if you want to use pseudo-elements as graphics (to give them size, position, background-image, border, background, etc – without actual content) you must still specify content: '' (empty string). Without setting content, the pseudo-element will not render, regardless of display, visibility or opacity.
Most CSS attributes that can be applied to a normal DOM element can be applied to pseudo-elements.
<label>s can have pseudo's, but that would mean the :before gets placed before the <input>, which is included in the <label>. If you want to place the :before after the <input> (which cannot have pseudo's), you have to wrap the text node in a <span>, as in the example.
Also note that, even though the spec defines pseudo elements officially with double colon notation (::pseudo-element), all browsers supporting double colon notation also support the legacy single colon notation, while a few legacy versions (IE pre v9, FF pre v1.5, Opera pre v7) only support the single colon notation. For this reason, most people use the single colon notation (which is, officially, wrong, but technically right, at least for now).
I am currently working on this website and as you can see I have 2 modals, one on the left and one on the right (the i icons).
What I want to do is to keep the modal buttons in the same position but make the whole section (the pictures with the girl and the texts) clickable.
Infos: I can only use that "i" icon as modal button :/ and I can only edit the CSS not the HTML.
Is this possible to open the modal window by clicking on the whole section?
Here some code:
HTML:
<div id="ts-vcsc-modal-5397504-container" class="ts-vcsc-modal-container">
<div id="ts-vcsc-modal-5397504-trigger" style="" class="ts-vcsc-modal-5397504-parent nch-holder ts-vcsc-font-icon ts-font-icons ts-shortcode ts-icon-align-center ">
<a href="#ts-vcsc-modal-5397504" class="nch-lightbox-modal no-ajaxy" data-width="1024" data-title="" data-open="false" data-delay="0" data-type="html" rel="" data-effect="slideUp" data-share="0" data-duration="5000" data-color="rgba(255,255,255,0.01)" data-lightbox-init="true">
<i class="ts-font-icon ts-awesome-info-circle" style="color: #ffffff; width:80px; height:80px; font-size:80px; line-height:80px;"></i></a></div>
<div id="ts-vcsc-modal-5397504" class="ts-modal-content nch-hide-if-javascript " style="display: none; padding: 15px; background: #0076bc;">
<div class="ts-modal-white-header"></div><div class="ts-modal-white-frame" style=""><div class="ts-modal-white-inner"><p></p>
<h2 style="text-align: left;"><span style="color: #ffffff;"><b>Wer seinen Mietvertrag im AQUILA bis 31.12.2016 unterzeichnet, erhält</b></span></h2>
<p><span style="color: #ffffff;">1 Nettomietzins geschenkt bei Einzug innert 3 Monaten</span><br>
<span style="color: #ffffff;"> 2 Nettomietzinse geschenkt bei Einzug per Dezember 2016</span></p>
<p><span style="color: #ffffff;">Zusätzlicher Weihnachtsgutschein von Sutter Begg oder AJ Salon hair & make up im Wert von CHF 1000.–</span></p>
</div>
</div>
</div>
</div>
Thanks in advice for your help.
.nch-lightbox-modal.no-ajaxy {
width: 100%;
height: 100%;
display: block;
position: absolute;
top: 0;
left: 0;
}
.ts-font-icon.ts-awesome-info-circle {
color: #ffffff;
width: 80px;
height: 80px;
font-size: 80px;
line-height: 80px;
position: absolute;
bottom: 25px;
right: 0;
}
Try this to your anchor tag and icon
I am trying to align label : control, label: control in 2 rows.
But text in my 2nd row moves to little bit right as below image. How can I align label and control in same line for second row also? These are generic forms so I dont want to add any height added to class. Any help would be highly appreciated.
Here is my Code
<div class="editor-label"><label for="DocumentSignature">This is a test label with big text below and below</label></div>
<div class="editor-field"><input class="text-box single-line" data-val="true" data-val-required="The Document Signature Services Request URL field is required." id="DocumentSignature" name="DocumentSignature" type="text" value="">
<span class="field-validation-valid" data-valmsg-for="DocumentSignature" data-valmsg-replace="true"></span></div>
<div class="editor-label"><label for="DealSummary">This is next div text which moved to right</label></div>
<div class="editor-field"><input class="text-box single-line" data-val="true" data-val-required="The Deal Summary Template URL field is required." id="DealSummary" name="DealSummary" type="text" value=""> <span class="field-validation-valid" data-valmsg-for="DealSummary" data-valmsg-replace="true"></span></div>
.editor-label {
max-width: 150px;
font-weight: 200;
font-size: 14pt;
letter-spacing: 0.01em;
line-height: 22pt;
float: left;
display: block;
}
.editor-field {
padding-bottom: 10px;
line-height: 22pt;
font-size: 10pt;
clear: right;
}
.label {
width: 180px;
display: block;
text-align: right;
margin-right: 15px;
}
Please see here for JsFiddle Demo
You have to wrap single row with one parent div and then clear all float at that div.
HTML:
<div class='single_row'>
<div class="editor-label"><label for="DocumentSignature">This is a test label with big text below and below</label></div>
<div class="editor-field"><input class="text-box single-line" data-val="true" data-val-required="The Document Signature Services Request URL field is required." id="DocumentSignature" name="DocumentSignature" type="text" value="" />
<span class="field-validation-valid" data-valmsg-for="DocumentSignature" data-valmsg-replace="true"></span></div>
</div>
<div class='single_row'>
<div class="editor-label"><label for="DealSummary">This is next div text which moved to right</label></div>
<div class="editor-field"><input class="text-box single-line" data-val="true" data-val-required="The Deal Summary Template URL field is required." id="DealSummary" name="DealSummary" type="text" value=""> <span class="field-validation-valid" data-valmsg-for="DealSummary" data-valmsg-replace="true"></span></div>
</div>
CSS:
.editor-label {
max-width: 150px;
font-weight: 200;
font-size: 14pt;
letter-spacing: 0.01em;
line-height: 22pt;
float: left;
display: block;
}
.single_row{ clear:both;}
.editor-field {
padding-bottom: 10px;
line-height: 22pt;
font-size: 10pt;
clear: right;
}
.label {
width: 180px;
display: block;
text-align: right;
margin-right: 15px;
}
Add a container that will contain both .editor-field and .editor-label. Without this, it will be very difficult if not impossible to make then work together.
<div class="editor-element">
<div class="editor-label">...</div>
<div class="editor-field">...</div>
</div>
Make this container "contain" the floated elements, so either add overflow: hidden, some kind of float or clearfix to it:
.editor-element {
overflow: hidden;
}
jsFiddle Demo
I'm a new user to StackOverflow. Looking forward to be part of your wonderful community. My question is as follows:
I want to use a Twitter Bootstrap modal box on my website. However, I'm facing problems getting the CSS to work on the modal box. I wrote the following HTML code:
<div id="playModal" class="modal hide fade">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<span class="login"><strong>Login</strong></span>
</div>
<div class="modal-body">
<form class="form-horizontal" accept-charset="utf-8" method="post" action="#">
<fieldset>
<div class="control-group">
<label class="control-label" for="play_form_username">Username</label>
<div class="controls">
<input type="text" id="play_form_username" name="username" placeholder="Enter your username" required />
</div>
</div>
<div class="control-group">
<label class="control-label" for="play_form_password">Password</label>
<div class="controls">
<input type="password" id="play_form_password" name="password" placeholder="Enter your password" required />
</div>
</div>
</fieldset>
<span>Forgot your password?</span>
<div class="form-actions">
<button type="submit" class="btn btn-primary">Play!</button>
</div>
</form>
</div>
<div class="modal-footer">
<span>Not a member yet? Join Now!</span>
<!--need to find a way to get this modal box to disappear if registerModal is called-->
</div>
</div>
Next, I want to configure the design of the page. I am using LESS to write code which is converted to CSS through SIMPLESS. I tried passing my desired CSS configuration through the modal div ID in the following LESS code:
#playModal{
width: 300px;
.modal-backdrop,
.modal-backdrop.fade.in{
opacity: 1;
filter: alpha(opacity=100);
}
.modal-header{
.login{
font-family: arial;
font-size: 60px;
font-weight: bolder;
}
}
.modal-body{
max-height: 200px;
}
}
This compiles successfully to CSS, but when I analyse the webpage using Firebug, it appears that none of the CSS has been passed for the modal box. Instead, if I use pass the CSS configurations by class, similar to the following, it works.
.modal{
width: 315px;
margin-left: 0px;
left: 50%;
top: 58px;
.modal-header{
padding: 7px 15px;
.login{
color: #203665;
font-size: 20px;
font-weight: bolder;
line-height: 24px;
}
}
}
Why is it that the CSS rules are not passed when referring to the modal box by ID? Isn't ID be more specific than class? Note: even when i use !important on the code using ID, it doesn't work.
It will be greatly appreciated if someone can help me out- though it's probably because I did something stupid. (The context why I need to use ID and not just class is: I'm needing to add a second modal box, and I want it to have different size, field sizes etc.) Thanks.
EDIT: (Answers my own silly question)
After dabbling around with the code, I found that the following works:
//Settings for all models
.modal-backdrop.fade.in{
opacity: 0.9!important;
filter: alpha(opacity=90)!important;
}
//Settings for playModal
#playModal{
width: 315px;
margin-left: 0px;
left: 50%;
top: 58px;
.modal-header{
padding: 7px 15px;
.login{
color: #203665;
font-size: 20px;
font-weight: bolder;
line-height: 24px;
}
}
.modal-body{
padding: 10px;
.control-group{
margin-bottom: 10px;
.control-label{
width: 65px;
text-align: left;
}
.controls{
margin-left: 75px;
}
}
span a{
display: block;
margin-top: 0px;
padding-top: 15px;
float: left;
&:hover{
text-decoration: none;
}
}
.form-actions{
display: block;
float: right;
margin: 0px;
padding: 0px;
border: 0px;
background-color: #FFFFFF;
.btn{
font-size: 18px;
line-height: 24px;
}
}
}
.modal-footer{
padding: 7px!important;
}
}
I think what I did wrong was to put the .modal-backdrop.fade.in inside the #playModal, it dawns on me now that .modal-backdrop.fade-in would be referring to the area outside of the #playModal div.
So all in all it was just a trivial mistake that got me worked up for so many hours. Sorry to waste everyone's time. What a way to start on StackOverflow. But anyway thanks everyone for trying to help me out. Please vote to close this post.
You're using the wrong case.
You give the element the id, playModal
Your css refers to #playmodal
Css is case-sensitive.