Full width input buttons on same line - input

I'm trying to make two input buttons (yes/no) display on the same line with maximum width for both. I want the width of the buttons to scale down in size as the browser window size decreases.
http://jsfiddle.net/jasonniebauer/grQGP/1/
<div id="merchant_radio6">
<p>
Ever accepted credit cards before?
</p>
<div>
<input type="radio" id="yes" name="accept_cc"/>
<label for="yes">
Yes
</label>
<input type="radio" id="no" name="accept_cc"/>
<label for="no">
No
</label>
</div>
</div>
#merchant_radio6 input[type="radio"],
#merchant_radio7 input[type="radio"] {
display: none;
}
#merchant_radio6 input[type="radio"] + label,
#merchant_radio7 input[type="radio"] + label {
box-sizing:border-box;
padding: 1rem 3rem 1rem 3rem;
width: 100%;
display: inline-block;
color: #BDC3C7;
background-color: #F2F2F2;
text-align: center;
vertical-align: middle;
cursor: pointer;
border-radius: 3px;
-webkit-transition: border .25s linear, color .25s linear, background-color .25s linear;
-webkit-transition-property: border, color, background-color;
-webkit-transition-duration: 0.25s, 0.25s, 0.25s;
-webkit-transition-timing-function: linear, linear, linear;
-webkit-transition-delay: initial, initial, initial;
transition: border .25s linear, color .25s linear, background-color .25s linear;
transition-property: border, color, background-color;
transition-duration: 0.25s, 0.25s, 0.25s;
transition-timing-function: linear, linear, linear;
transition-delay: initial, initial, initial;
}
#merchant_radio6 input[type="radio"] + label:nth-of-type(2),
#merchant_radio7 input[type="radio"] + label:nth-of-type(2) {
margin-left: 1rem;
}
#merchant_radio6 input[type="radio"]:checked + label,
#merchant_radio7 input[type="radio"]:checked + label {
background-color: #3498DB;
color: #FFFFFF;
outline: 0;
}

Set each button width to 50% and set them to float: left. If you want space between your buttons, you'll need to do something like width: 49%; margin-left: 1%;

Each button needs to be set to 50% width or less for them to appear on the same line. When width is set as a percentile, it uses the parent's width to calculate its own width - it makes no adjustments based on sibling elements' widths.
Edit: because you have margins set, these will need to be at <50% width. For most (all?) browsers, margins are calculated separately from width when considering display. E.g. an element that's 50% width and has a 10px margin on each side will take up more than 50% of its parent container's width. Note that some browsers might also treat borders this way.

Related

Border is not applied correctly when applying :focus to a input

I have an input with a defined border and background color. I apply a transition for the :focus selector which works fine except that the border becomes inner.
input {
border: solid 3px black;
background-color: red;
margin-bottom: 20px;
transition-property: color, background-color, transform;
transition-duration: 2s;
}
input:focus {
color: white;
background-color: blue;
transform: scale(1.5) translate(27px, 0);
margin-top: 10px;
}
<form method="get">
<label for="name">Name:</label><br>
<input type="text" id="name">
</form>
I guess the problem is the scale() function. How can I make the border to be outside when clicking on the input, as usual.
Thanks

Center align absolute elements inside flex items

I'm trying to horizontally align two absolute positioned elements inside a flex item.
This is my current CodePen
HTML :
<div class="stepper-wrapper">
<ul class="step-wrapper" >
<li class="step__bubble"></li>
<li class="step__circle"></li>
</ul>
<ul class="step-wrapper" >
<li class="step__bubble"></li>
<li class="step__circle"></li>
</ul>
</div>
CSS :
.stepper-wrapper {
display: flex;
flex-direction: row;
}
ul {
border: 1px solid grey;
height: 0px;
position: relative;
top: 40%;
min-width: 100px;
flex: 1;
li.step__bubble {
display: inline-block;
vertical-align: middle;
}
li.step__bubble::before {
content: "";
position: absolute;
top: -9px;
left: calc(50%);
display: block;
width: 16px;
height: 16px;
border: 2px solid grey;
border-radius: 50%;
background: white;
}
li.step__circle {
width: 8px;
height: 8px;
border: 1px solid red;
border-radius: 50%;
display: block;
position: absolute;
top: -4px;
left: calc(50% + 1px);
}
}
What I want to do is :
Having the grey circle vertically and horizontally aligned over the
line. Vertically is not really a pb, I'm able to set a fixed value as the height of the .stepper-wrapper will be fixed. Horizontally needs to be adaptative and it's where I'm stuck.
Having the red circle right inside the grey circle
I tried to use the calc() function and set it to (50% - width_of_element_in_px/2) for both circles, but I don't know why, each px seems to be ~10px.
Thx for your help
Welcome to the club of the LESS users pwned by calc() and string interpolation
I've been using LESS since 5 years and it still happens from time to time :(
Sooo tl;dr calc() was and is a LESS function that its compiler will happily output as some result (probably 50% + 10(stripped) => 60%).
If you want LESS compiler to output calc() the CSS Level 3 function, you need to escape it, that is wrap it in ~"calc(50% + 5px)"!
Codepen
EDIT: also see https://stackoverflow.com/a/17904128/137626
EDIT2: couldn't find an entry about calc in LESS documentation oO but the problem is explained in http://lesscss.org/usage/#command-line-usage-options (search "calc" in text). strict-math is a cool option but you'll have to make sure everybody else has it activated (won't be the case by default)

Is this possible? transparent png over slide revolution (clickable)

I want two slide revolutions (or at least one), but with this skin over it:
The overlay image would be on top of the images, so clicking the gallery would be impossible (and the bullets to change image inside of it). I know about map coordinates, but it's a slider revolution, so it will not work in this case I think.
Is there any way to achieve this?
My HTML & CSS so far: (JSFiddle)
<div class="thePNG"></div>
<div class="theSLIDERS">
<div class="fakeSLIDER1">HEY' IM CLICKABLE</div>
<div class="fakeSLIDER2"></div>
</div>
.thePNG {
background-image: url(my-overlay-image.png);
width: 787px;
height: 610px;
background-size: cover;
z-index: 2;
position: relative;
}
.theSLIDERS{
margin-top: -600px;
z-index: 1;
}
.fakeSLIDER1{
background-color: red;
width: 700px;
height: 300px;
text-align: center;
margin: 0 auto 0 auto;
}
.fakeSLIDER2{
background-color: green;
width: 700px;
height: 300px;
}
I found my own answer!
its easy:
CSS:
"pointer-events: none;"
!

Jssor Slider(Banner Slider): How to show a text in two lines

I'm needing to show the Text Slide Banner Jsson on Two lines. When I insert text larger than the box size it does not show, I would text aparececi the row below, ie show the text on two lines.
https://www.flickr.com/photos/robisonweb/15388049446/
I managed to position the text box, failed to show the text on two lines.
https://www.flickr.com/photos/robisonweb/15410760422/
I appreciate the help.
[ ]'s Robison
Please change line-height from 45px to 22px, and change font-size from 20px to 16px;
That's to say, replace
<thumbnailtemplate style="font-family: verdana; font-weight: normal; POSITION: absolute; WIDTH: 100%; HEIGHT: 100%; TOP: 0; LEFT: 0; color:#fff; line-height: 45px; font-size:20px; padding-left:10px;"></thumbnailtemplate>
with
<thumbnailtemplate style="font-family: verdana; font-weight: normal; POSITION: absolute; WIDTH: 100%; HEIGHT: 100%; TOP: 0; LEFT: 0; color:#fff; line-height: 22px; font-size:16px; padding-left:10px;"></thumbnailtemplate>
and then you can define 2 line text thumbnail as below,
<div u="thumb">Do you notice it is draggable by mouse/finger?<br />Second line</div>

Border inside a cell

How do I set CSS to show borders inside td rather than outside on hover. Normally when I hover a cell and I have set border in hover style, the table rows moves by width of hover border. I want it to show inside thus no moving. (For example cell is 10px width and I add 2px border I still want it be 10 pixel width but with 2px border on each side, thus 6px left for consent.)
jsfiddle: http://jsfiddle.net/reg4f/
Here's my HTML:
<table>
<tr>
<td>
<a>po</a>
</td>
<td>
<a>Ășt</a>
</td>
</tr>
<table>
and CSS
table {
width: 250px;
height: 250px;
table-layout: fixed;
border: solid black 1px;
border-collapse: collapse;
}
table td, table tr {
text-align: right;
vertical-align:middle;
}
td:hover{
background-color: #E5F3FB;
border: solid 4px #70C0E7;
border-style: inset;
}
td a {
display:block;width:100%;height:100%;margin:0
}
You can try to add a white or transparent border to the cell, when it's not :hover and override this white border by your colored one when it's :hover. So you have no moving.
td {
border: solid 4px rgba(0,0,0,0);
}
Here is an example:
http://jsfiddle.net/G6w9P/
I'd suggest adding padding to not hover of the same width as the border on hover. On hover remove the padding and add the border.
Something like:
td{
padding:2,2,2,2;
border:none;
}
td:hover{
padding:0,0,0,0;
border:solid 2px red;
}
Cheers
-L