2 inputs divided by a slash - html

can someone help me achieve that 2 ínputs look like one divided by a slash
Also doing it with twitter-bootstrap
Idea : http://postimg.org/image/pcgbzj4s1/
What I got so far but there is divided also I think they should overlap(slash with inputs)
<input class="form-control" type="text" name="kerkim" id="input_main">
<i id="slash">/</i>
<div class="input-group">
<input id="address" class="form-control" type="text" >
<div class="input-group-btn">
<button type="submit" class="btn btn-ẃarning"><i class="glyphicon glyphicon-search"></i></button>
</div>
</div>

http://codepen.io/oroborus357/pen/doVKEP Here's the quick codepen I made for you, it shoud do what you need :)
<span class="first"><input type="text" /></span><input class="second" type="text" />
body {
padding: 50px;
background: #333;
}
* {
box-sizing: border-box;
}
input {
background: white;
border: none;
padding-left: 15px;
}
.first {
position: relative;
}
.first:before {
content: "/";
position: absolute;
left: 100%;
top: 0;
height: 100%;
transform: translateX(-50%);
font-size: 18px;
}

Many ways to it... here's two.
Given this html:
<div class="container">
<input type="text">
<span class="slash"></span>
<input type="text">
</div>
With this CSS:
.container{
border: 1px solid #999;
display: inline-block;
border-radius: 3px;
background: #fff;
margin-top: 50px;
position: relative;
}
.container input{
border: none;
background: none;
}
.slash{
transform: scale(3);
position: absolute;
}
/* or.... */
.slash{
width: 2px;
height: 28px;
background: #999;
transform: rotate(20deg);
position: relative;
display: inline-block;
position: absolute;
top: -5px;
}
A demo here

Related

How to make the label go up after clicking with css?

I want to make a form when on clicked the label would go up 15px and you can write the text, but I can't figure out how to do it with my current code. I think the problem is how I select the label and input.
I tried these ways:
.form-row-field-input:focus ~ label,
.form-row-field-input:valid ~ label {
top: -12px;
left: 0;
font-size: 12px;
color: #003333;
font-weight: bold;}
input[type=text]:focus~label {
display:block;
color: black;
top: -20px;
font-size: 14px;}
<div class="form-inputs">
<form action="" method="POST">
<div class="form-row">
<span class="form-row-number">01</span>
<label for="POST-name" class="form-row-field">First name</label>
<input type="text" class="form-row-field-input">
</div>
<div class="form-row">
<span class="form-row-number">02</span>
<label for="POST-lastname" class="form-row-field">Last name</label>
<input type="text" class="form-row-field-input">
</div>
<div class="form-row">
<span class="form-row-number">03</span>
<label for="POST-email" class="form-row-field">Email</label>
<input type="text" class="form-row-field-input">
</div>
<input class="form-btn" type="submit" value="Get it">
</form>
</div><!--end-->
/** CSS **/
.form-inputs {
padding: 40px;
flex: 60%;
display: flex;
flex-direction: column;
align-content: center;
justify-content: center;
position: relative;
}
.form-btn {
margin: 20px 0px;
background-color: #f6fe00;
color: black;
padding: 10px 40px;
font-weight: 700;
border: none;
cursor: pointer;
}
.form-row {
border-bottom: 1px solid grey;
padding: 10px 0px;
position: relative;
}
.form-row-number {
color: #8f63ff;
padding-right: 10px;
}
.form-row-field {
color: #9b91f5;
position: absolute;
pointer-events: none;
transition: 0.5s;
top: 10px;
margin-left: 1em;
}
.form-row-field-input {
background-color: inherit;
border: none;
display: block;
position: absolute;
top: 10px;
transition: 0.5s;
margin-left: 1.5em;
}
I expect that when clicked on input, the label would go up with a transition
The general sibling selector in CSS that you're using can only target elements that come AFTER, so since the label comes before the input in your HTML, it's not actually applying the CSS.
You can get the intended effect simply be moving the label element after the input. Google's Material UI also takes this approach in order to keep it primarily CSS to achieve the intended visual effect.
Here it is with the label elements moved to after the input and slightly tweaked CSS:
<body>
<div class="form-inputs">
<form action="" method="POST">
<div class="form-row">
<span class="form-row-number">01</span>
<input type="text" class="form-row-field-input">
<label for="POST-name" class="form-row-field">First name</label>
</div>
<div class="form-row">
<span class="form-row-number">02</span>
<input type="text" class="form-row-field-input">
<label for="POST-lastname" class="form-row-field">Last name</label>
</div>
<div class="form-row">
<span class="form-row-number">03</span>
<input type="text" class="form-row-field-input">
<label for="POST-email" class="form-row-field">Email</label>
</div>
<input class="form-btn" type="submit" value="Get it">
</form>
</div>
<!--end-->
</body>
.form-inputs {
padding: 40px;
flex: 60%;
display: flex;
flex-direction: column;
align-content: center;
justify-content: center;
position: relative;
}
.form-btn {
margin: 20px 0px;
background-color: #f6fe00;
color: black;
padding: 10px 40px;
font-weight: 700;
border: none;
cursor: pointer;
}
.form-row {
border-bottom: 1px solid grey;
padding: 10px 0px;
position: relative;
}
.form-row-number {
color: #8f63ff;
padding-right: 10px;
}
.form-row-field {
color: #9b91f5;
position: absolute;
pointer-events: none;
transition: 0.5s;
top: 10px;
margin-left: 1em;
}
.form-row-field-input {
background-color: inherit;
border: none;
display: block;
position: absolute;
top: 10px;
transition: 0.5s;
margin-left: 1.5em;
}
.form-row-field-input:focus~label {
top: -5px;
font-size: 12px;
color: #003333;
font-weight: bold;
}
https://jsfiddle.net/7urgeL60/

CSS Radio-button and text outline

I'm having a problem with setting up box & shadow around my radio button. My CSS sets box only around radio button and shows nasty white square box around it. How to set border or outline around whole Radio-button + text to make selection more distinctive.
enrgy-form {
width: 50%;
float: right;
}
.label-width {
margin-left: 22px;
white-space: nowrap;
}
.label-nowrapp {
white-space: nowrap;
}
.selected-item input:checked {
/*border: 1px solid dodgerblue;*/
box-shadow: 3px 3px 11px 1px dodgerblue;
}
<div class="form-check enrgy-form">
<label class="form-check-label label-nowrapp selected-item">
<input class="form-check-input selected-item" type="radio" name="energy" formControlName="energy" value="Energy" (change)="setOptions()">Fuel-fired</label>
</div>
I think your best bet is to simulate the radio button with css so you can have the behavior you want.
You should first set the input to display: none and give it an id in your HTML so you can link it with the label, by giving the label a for attribute, this way you can control the check/uncheck of your radio button from the label.
Next you want to simulate the appearance of the radio button, i'll do this by adding two spans, one inside the other, so we can have a checked/unchecked status.
try this:
enrgy-form {
width: 50%;
float: right;
}
.label-width {
margin-left: 22px;
white-space: nowrap;
}
.label-nowrapp {
white-space: nowrap;
}
.selected-item {
display: none;
}
.selected-item:checked + label {
box-shadow: 0px 0px 11px 2px dodgerblue;
}
label{
padding: 3px;
}
label .bullet{
border-radius: 50%;
border: 1px solid gray;
background-color: lightgray;
margin-right: 3px;
display: inline-block;
width: 10px;
height: 10px;
position: relative;
}
.selected-item:checked + label .bullet .bullet-selected{
position: absolute;
top: 50%;
left: 50%;
border-radius: 50%;
transform: translate(-50%, -50%);
display: inline-block;
width: 5px;
height: 5px;
background-color: gray;
}
<div class="form-check enrgy-form">
<input class="form-check-input selected-item" type="radio" name="energy" formControlName="energy" value="Energy" (change)="setOptions()" id="someUniqueId"/>
<label class="form-check-label label-nowrapp" for="someUniqueId">
<span class="bullet">
<span class="bullet-selected"></span>
</span>
Fuel-fired
</label>
</div>
You could go the route where you style the whole radio button using :before and :after in CSS. That way you could even go nuts with animations and stuff...
It would require you to change the HTML a bit as well....
There's plenty of examples to be found if you search for "css custom radio".
[type="radio"]{
position: absolute;
left: -9999px;
}
[type="radio"] + label
{
position: relative;
padding: 0 20px;
cursor: pointer;
}
[type="radio"] + label:before{
content: '';
position: absolute;
left: 0;
top: 0;
width: 14px;
height: 14px;
border: 1px solid #ddd;
border-radius: 100%;
background: #fff;
}
[type="radio"]:checked + label:before{
box-shadow: 0px 1px 11px 1px dodgerblue;
}
[type="radio"] + label:after{
content: '';
display: none;
width: 10px;
height: 10px;
background: gray;
position: absolute;
top: 3px;
left: 3px;
border-radius: 100%;
}
[type="radio"]:checked + label:after {
display: block;
}
<div class="form-check enrgy-form">
<input type="radio" name="energy" id="one">
<label for="one">Fuel-fired</label>
</input>
<input type="radio" name="energy" id="two">
<label for="two">Something else</label>
</input>
</div>
Update
Here is a possible solution, you could modify it as you want!
.form-check {
position: relative;
display: inline-flex;
align-items: center;
font-size: 1rem;
}
.form-check-label {
font-size: 0.9em;
margin-right: 0.25em;
white-space: nowrap;
}
.form-check-input {
margin: 0;
margin-right: 0.5em;
}
.form-check-input:checked + .form-check-label:after {
content: '';
width: 100%;
height: 100%;
top: 0;
left: 0;
position: absolute;
border-radius: 1.5em 8px 8px 1.5em;
box-shadow: 3px 3px 11px 1px dodgerblue;
}
.medium { font-size: 2rem; }
.medium input[type=radio] { zoom: 2 }
.big { font-size: 3rem; }
.big input[type=radio] { zoom: 3 }
<div class="form-check">
<input id="inputcheck" class="form-check-input" type="radio" name="energy" formControlName="energy" value="Energy">
<label for="inputcheck" class="form-check-label">Fuel-fired normal</label>
</div>
<br><br>
<div class="form-check medium">
<input id="inputcheck1" class="form-check-input" type="radio" name="energy" formControlName="energy" value="Energy">
<label for="inputcheck1" class="form-check-label">Fuel-fired medium</label>
</div>
<br><br>
<div class="form-check big">
<input id="inputcheck2" class="form-check-input" type="radio" name="energy" formControlName="energy" value="Energy">
<label for="inputcheck2" class="form-check-label">Fuel-fired big</label>
</div>

Image inside input text

I have this desing and I´ll like to program it but I dont find the way.
Does anyone know how to make it?
How can I put that '+' inside?
Here is the piece of code:-
.busqueda_input{
border-radius: 50px 50px 50px 50px;
background-color: #EBE9E9;
width: 30%;
height: 20px;
}
<div class="recep-estado">
RECEPCIÓN <hr id="hr-vertical-azul"> <input type="text" class="busqueda_input" name="">
ESTADO <hr id="hr-vertical-azul"> <input type="text" class="busqueda_input" name="">
</div>
You can use the position:absolute, you can literally play with css to get the required output there are many number of way for what u have asked here is something which i have made
Example
.input-field{
position: relative;
width: 250px;
}
.input-field input{
border:none;
background-color: #ccc;
border-radius: 10rem;
width:100%;
height: 25px;
}
.icon{
position: absolute;
top:0;
right:0;
color: white;
font-weight: 600;
font-size: x-large;
background: black;
padding-right: 10px;
padding-left: 5px;
border-top-right-radius: 10rem;
border-bottom-right-radius: 10rem;
}
<div class="input-field">
<input type="text" >
<div class="icon">+</div>
</div>
Try this.
.busqueda_input{
border-radius: 50px 50px 50px 50px;
background-color: #EBE9E9;
width: 190px;
height: 20px;
border:1px solid #ccc;
}
.input-wrap {
position: relative;
display: inline-block;
}
.input-wrap .icon {
background: #616261;
border-radius: 0 50px 50px 0;
bottom: 0;
position: absolute;
right: 0;
text-align: center;
top: 0;
width: 29px;
color: #fff;
font-size: 19px;
}
<div class="recep-estado">
RECEPCIÓN <hr id="hr-vertical-azul">
<div class="input-wrap">
<input type="text" class="busqueda_input" name="">
<div class="icon">+</div>
</div>
ESTADO
<hr id="hr-vertical-azul">
<div class="input-wrap">
<input type="text" class="busqueda_input" name="">
<div class="icon">+</div>
</div>
</div>
you can add pseudo element to the parent div
http://jsfiddle.net/w9ew0nrw/7/
<div class="recep-estado">
RECEPCIÓN <hr id="hr-vertical-azul">
<div class="input-group">
<input type="text" class="busqueda_input" name="">
</div>
ESTADO <hr id="hr-vertical-azul">
<div class="input-group">
<input type="text" class="busqueda_input" name="">
</div>
</div>
.busqueda_input{
border-radius: 50px 50px 50px 50px;
background-color: #EBE9E9;
height: 30px;
border:0;
}
.input-group {
position:relative;
width:200px;
}
.input-group:after {
position:absolute;
top;0;
right:0;
width:30px;
height:30px;
background-color:#333;
color:#fff;
content:"+";
border-radius:0 100% 100% 0;
text-align:center;
line-height:30px;
font-size:20px;
}
You can try this code:
also if you want button instead of + label.
1st textbox is for label
2nd is for button
.busqueda_input {
border-radius: 50px 50px 50px 50px;
background-color: #EBE9E9;
width: 100%;
height: 40px;
border: none;
outline: none;
display: inline-block;
text-indent: 15px;
}
.input-div , .input-div-2 {
width: 50%;
position: relative;
margin-bottom:20px;
}
.input-div:after , .input-div-2 button {
content: "+";
position: absolute;
right: 0px;
top: 0;
background: #616261;
bottom: 0;
border-radius: 50px;
width: 50px;
text-align: center;
font-size: 35px;
color: #fff;
border:none;
outline:none;
}
button{
cursor: pointer;
}
<div class="recep-estado">
RECEPCIÓN <hr id="hr-vertical-azul">
<div class="input-div">
<input type="text" class="busqueda_input" name="">
</div>
ESTADO <hr id="hr-vertical-azul"> <div class="input-div-2"><input type="text" class="busqueda_input" name="">
<button>+</button>
</div>
</div>

ionic - input box width

I am having a problem with the input boxes in my login.html. I am not able to increase the width of the input boxes. If I am increasing the width to 100%, the height is increasing with it.
Here is an image showing the width.
I want the width to be almost double of it.
Here is a link to my html and css:
https://jsfiddle.net/ybkjv8uw/
item.item-input {
border: none;
position: relative;
left: 0px;
top: 135px;
background-color: transparent;
}
.item.item-input {
border: none;
position: relative;
top: 135px;
background-color: transparent;
width:100%;
}
.item.item-input>span{
width:auto;
}
.item.item-input>input{
width:68%;
}
.view-content {
background-color:#85b818;
}
.img-div {
position: relative;
left: 110px;
top: 35px;
}
.item.item-input {
border: none;
position: relative;
left: 0px;
top: 135px;
background-color: transparent;
width:100%;
}
.item.item-input span{width:auto;}
.item.item-input input{width:68%;}
/*.item-input-inset .item-input-wrapper input {
padding-left: 4px;
height: 29px;
background: transparent;
line-height: 18px;
// you should add the following:
box-sizing: border-box;
width: 100%;
}*/
input::-webkit-input-placeholder {
color: white;
}
label {
/*display: block; width: 100%;*/
width:200px;
float: left;
/*clear:left;*/
text-align:right;
/*padding-right:10px;*/
}
input{
/*float:left;*/
}
.enter-div {
text-align: center;
}
.enter-button {
position: relative;
top: 170px;
width: 280px;
height: 50px;
border-radius: 25px;
border: none;
background-color: green;
color: white;
}
.foyopass-div {
position: relative;
text-align: center;
top: 200px;
color: white;
}
<ion-view class="view-content">
<div class="img-div">
<img src="img/main_logo_icon.png" style="width : 40% ; height : 20%" >
</div>
<div>
<label class="item item-input">
<span class="input-label" ><img src="img/email_icon.png" style="width: 30%" ></span>
<input type="email" placeholder="Email">
</label>
</div>
<div>
<label class="item item-input">
<span class="input-label" ><img src="img/password_icon.png" style="width: 25%"></span>
<input type="password" placeholder="Password">
</label>
</div>
<div class="enter-div">
<button class="enter-button">
Enter
</button>
</div>
<div class="enter-div">
forgot your password?
</div>
</ion-view>

Show/hide a div by clicking a checkbox,not working

input[type=checkbox] {
border: 0;
clip: rect(0 0 0 0);
height: 1px;
width: 1px;
margin: -1px;
overflow: hidden;
padding: 0;
position: absolute;
}
`.ds-drop-down` {
background: url('../../images/light-grey-disclosure-arrow-down.png')no-repeat scroll center center transparent;
padding: 10px 5px;
height: 0px;
width: 8px;
position: absolute;
top: 63px;
border: 1px solid blue;
}
.ds-btn {
height: 22px;
width: 20px;
padding: 4px;
top: 63px;
position: absolute;
border: 1px solid blue;
left: 579px;
}
#span-advanced-search {
border: 2px solid blue;
left: 20px;
width: 600px;
padding: 10px;
}
input[type=checkbox]:checked ~ div {
background: green;
display: block;
visibility: visible;
position: absolute;
width: 600px;
padding: 10px;
}
<label for="toggle-1" class="ds-drop-down" role="button" data-tooltip="Show search options"/>
<input type="checkbox" id="toggle-1"></input>
<div id="span-advanced-search">
<label>Education Level:</label> <input type="text"/><br></br>
<label>Type of Learning Material:</label> <input type="text"/><br></br>
<label>Difficulty Level:</label> <input type="text"/><br></br>
<label>Author:</label> <input type="text"/><br></br>
</div>
I want to show div-> 'span-advanced-search' by clicking on the checkbox->'toggle-1'. Initially the div will be hidden and when the checkbox is unchecked then also the div must be hidden.
I have shared my code snippet above,it's not working,when i am clicking on the checkbox the div is not showing.Please help me.
I'm not sure if this is what you are looking for, but hope it helps some way.
$(document).ready(function(){
$('input[type="checkbox"]').click(function(){
if($(this).attr("value")=="checkbox"){
$("#span-advanced-search").toggle();
}
});
});
#span-advanced-search{
padding: 20px;
display: none;
margin-top: 20px;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div>
<label><input type="checkbox" name="colorCheckbox" value="checkbox"></label>
</div>
<div id="span-advanced-search">
<label>Education Level:</label> <input type="text"/><br></br>
<label>Type of Learning Material:</label> <input type="text"/><br></br>
<label>Difficulty Level:</label> <input type="text"/><br></br>
<label>Author:</label> <input type="text"/><br></br>
</div>