How to have a close icon show up on <input> active state - css

I have a input field with search icon. When the input field is pressed/focused I want to have a close icon show up on the input box as in the below image
jsfiddle
<div id="search-controls">
<input type="text" class="search-box in-acvtive" placeholder="e.g. restaurant name, cuisine" />
</div>
#search-controls {
height: 68px;
padding: 5px;
}
#search-controls input.ui-input-text {
height: 26px;
background: url('../img/search-icon.png') 99.5% center no-repeat;
background-size: 16px 14px;
border: 1px solid #999;
-moz-border-radius: 2px;
border-radius: 2px;
-moz-box-shadow: inset 0px 5px 10px -5px #BBB;
-webkit-box-shadow: inset 0px 5px 10px -5px #BBB;
box-shadow: inset 0px 0px 5px 10px -5px #BBB;
padding: 6px 5px 0 5px;
margin: 0 0 5px 0;
font-size: 15px;
line-height: 15px;
}
#search-controls input.ui-input-text.ui-focus {
border: 1px solid #9E0249;
border-radius: 2px;
-moz-border-radius: 2px;
-webkit-border-radius: 2px;
box-shadow: none;
moz-box-shadow: none;
-webkit-box-shadow: none;
background: url('../img/search-active-icon.png') 100% center no-repeat;
}

Try something like this - DEMO
HTML
<div id="header" class="search" data-role="header" data-position="fixed">
<div id="search-controls">
<input type="text" class="search-box" placeholder="e.g. restaurant name, cuisine" />
<span> x </span>
</div><!-- /search-controls -->
</div>​
CSS
#search-controls span {
display: none;
position: absolute;
top: 11px;
right: 35px;
height: 22px;
width: 22px;
background: #bbb;
border-radius: 20px;
color: #fff;
font: 400 20px/22px 'Lucida Console', sans-serif;
text-align: center;
border: 1px solid #bbb;
cursor: pointer;
}
#search-controls input.ui-input-text.ui-focus ~ span {
display: block;
}

Related

How to add a border to a pseudo-element: before?

Good afternoon, tell me please. I made up a block with a protruding corner on top of the block. On the whole block I have a corner that I made using box-shadow. How can I make exactly such a frame for a pseudo-element (.comment_text:before)
.comment{
margin-top: 20px;
padding: 0px 20px 0px 20px;
}
.comment_text{
max-width: 680px;
background-color: #f1fbff;
padding: 10px;
margin-top: 15px;
color: #FFF;
position: relative;
font-size: 12px;
line-height: 20px;
-webkit-box-shadow: 0px 0px 0px 1.5px #cfcfcf;
-moz-box-shadow: 0px 0px 0px 1.5px #cfcfcf;
box-shadow: 0px 0px 0px 1.5px #cfcfcf;
color: #333333;
font-size: 12pt;
font-family: Arial, sans-serif;
}
.comment_text:before {
content: "";
display: block;
border-bottom: 15px solid #f2fbff;
border-right: 20px solid transparent;
border-left: 0px solid transparent;
position: absolute;
top: -15px;
left: 22px;
}
<div v-for='comment in comments' class="comment">
<div class="comment_text">Some Text</div>
</div>
You can create another psudo element (::after) and make it litter bigger. Add the color similar to your Div border.
.comment{
margin-top: 20px;
padding: 0px 20px 0px 20px;
}
.comment_text{
max-width: 680px;
background-color: #f1fbff;
padding: 10px;
margin-top: 15px;
color: #FFF;
position: relative;
font-size: 12px;
line-height: 20px;
-webkit-box-shadow: 0px 0px 0px 1.5px #cfcfcf;
-moz-box-shadow: 0px 0px 0px 1.5px #cfcfcf;
box-shadow: 0px 0px 0px 1.5px #cfcfcf;
color: #333333;
font-size: 12pt;
font-family: Arial, sans-serif;
}
.comment_text:before {
content: "";
display: block;
border-bottom: 15px solid #cfcfcf;
border-right: 20px solid transparent;
border-left: 0px solid transparent;
position: absolute;
top: -15px;
left: 22px;
}
.comment_text:after {
content: "";
display: block;
border-bottom: 18px solid #f2fbff;
border-right: 20px solid transparent;
border-left: 0px solid transparent;
position: absolute;
top: -12px;
left: 24px;
}
<div v-for='comment in comments' class="comment">
<div class="comment_text">{{ comment.text }}</div>
</div>
Try adding Height and Width to it. and play with it until you have the desired effect.
You can also add a background to define what color you want it in
.comment_text:before {
content: "";
display: block;
border-bottom: 15px solid #f2fbff;
border-right: 20px solid transparent;
border-left: 15px solid transparent;
position: absolute;
top: -15px;
left: 2px;
height: 1px;
width: 10px;
background: blue;
}
.comment{
margin-top: 20px;
padding: 0px 20px 0px 20px;
}
.comment_text{
max-width: 680px;
background-color: #f1fbff;
padding: 10px;
margin-top: 15px;
color: #FFF;
position: relative;
font-size: 12px;
line-height: 20px;
-webkit-box-shadow: 0px 0px 0px 1.5px #cfcfcf;
-moz-box-shadow: 0px 0px 0px 1.5px #cfcfcf;
box-shadow: 0px 0px 0px 1.5px #cfcfcf;
color: #333333;
font-size: 12pt;
font-family: Arial, sans-serif;
}
.comment_text:before {
content: "";
display: block;
border-bottom: 15px solid #f2fbff;
border-right: 20px solid transparent;
border-left: 0px solid transparent;
position: absolute;
top: -15px;
left: 22px;
box-shadow: -2px 0px 0px -0.5px #cfcfcf;
}
.comment_text:after {
content: "";
display: block;
width: 23px;
height: 0px;
top: -8px;
left: 20px;
box-shadow: 0px 0px 0px 1px #cfcfcf;
transform: rotate(35deg);
position: absolute;
}

Checkbox: can't check checkbox in Safari

i've created a contact form with Contact Form 7 Plugin (Wordpress) checkbox but i can't chech them in Safari.
How can i solve it? http://www.r90.ch/contact-form/
CSS:
.myinput[type="checkbox"]{
width: 11px !important;
height: 11px !important;
border: 1px solid #808080 !important; }
Try this code for checkbox style
<style>
.regular-checkbox {
-webkit-appearance: none;
background-color: #fafafa;
border: 1px solid #cacece;
box-shadow: 0 1px 2px rgba(0,0,0,0.05), inset 0px -15px 10px -12px rgba(0,0,0,0.05);
padding: 9px;
border-radius: 3px;
display: inline-block;
position: relative;
}
.regular-checkbox:checked:after {
content: '\2714';
font-size: 14px;
position: absolute;
top: 0px;
left: 3px;
color: #99a1a7;
}
</style>
<input type="checkbox" id="checkbox-1-1" class="regular-checkbox" />

CSS Loginform failed

Look at my login-form (enter link description here.
I don't know why, but the Text-Field is not as large as the login-field -10px left and right (margin).
What did I wrong?
I hope you can help me, Thanks!
Codes:
Markup:
<div class="sidebar">
<div class="widget">
<h1>Login</h1>
<form class="login_form">
<p>
<label for="auth_id">Auth-Id:</label>
<input id="auth_id" type="text" name="auth_id">
</p>
<p>
<input type="submit" value="Login" class="submit">
</p>
</form>
</div>
</div>
CSS:
.sidebar {
float: left;
width: 200px;
}
.sidebar .widget {
-webkit-border-radius: 5px;
border-radius: 5px;
border: 1px solid #0b145f;
margin-left: 20px;
background-color: #f8f8fe;
-webkit-box-shadow: inset 0px 0px 0px 3px rgba(255,255,255,0.8), 0px 3px 0px -2px rgba(0,0,0,0.1);
box-shadow: inset 0px 0px 0px 3px rgba(255,255,255,0.8), 0px 3px 0px -2px rgba(0,0,0,0.1);
}
.sidebar .widget h1 {
font-family: 'Quicksand';
margin: 13px 10px 5px;
padding-bottom: 10px;
border-bottom: 1px dotted #0b145f;
-webkit-border-radius: 2px 2px 0px 0px;
border-radius: 2px 2px 0px 0px;
margin-bottom: 10px;
}
.sidebar .widget p {
margin: 0;
padding: 0;
}
.sidebar .widget .login_form label {
margin: 10px 10px 0 10px;
display: block;
}
.sidebar .widget .login_form input {
margin: 10px 10px 0 10px;
padding: 10px;
}
You need to give the input its own width, right now it is inheriting the width of the form and when you added the padding and margin it pushes it outside the container.
.sidebar .widget .login_form input {
margin: 10px 10px 0 10px;
padding: 10px;
width: 70%;
}

Search Bar Looks Fine When Loaded But Weird Position When Loading Page

Every time I load my website or navigate the search bar button loads from different place and moves back to place after it's loaded what is wrong? Please see image to understand what I mean
http://i.stack.imgur.com/hNvGh.png
HTML Code:
<form class="searchautocomplete UI-SEARCHAUTOCOMPLETE" action="/catalogsearch/result/" method="get" data-tip="What are you shopping for?" data-url="/searchautocomplete/ajax/get/" data-minchars="3" data-delay="300">
<div class="nav">
<div class="nav-search-in">
<span class="category-fake UI-CATEGORY-TEXT">All</span>
<span class="nav-down-arrow"></span>
<select name="cat" class="category UI-CATEGORY" style="width: 52px;">
<option value="0">All</option>
<option value="3">
Appliances </option>
<option value="4613">
Books </option>
<option value="11778">
Camera & Photo </option>
<option value="13675">
Computers & Accessories </option>
<option value="43960">
Video Games </option>
<option value="44397">
Watches </option>
</select>
</div>
<div class="nav-input UI-NAV-INPUT" style="padding-left: 52px;">
<input class="input-text UI-SEARCH" type="text" autocomplete="off" name="q" value="" maxlength="128">
</div>
<div class="searchautocomplete-loader UI-LOADER" style="display:none;"></div>
</div>
<div class="nav-submit-button">
<button type="submit" title="Search" class="button"><span><span>Search</span></span></button> </div>
<div style="display: none;" class="searchautocomplete-placeholder UI-PLACEHOLDER"></div>
</form>
CSS Code:
.searchautocomplete {
float: left;
text-align: left;
box-shadow: none;
font-family: helvetica,arial,sans-serif;
position: relative;
background: none;
margin: 8px 20px 7px 20px;
}
.searchautocomplete .nav {
background: url('/skin/frontend/default/galaopendeal/images/bkg-shadow.png');
float: left;
height: 29px;
position: relative;
}
.searchautocomplete .nav .nav-input {
margin: 6px 0px 0px 10px;
padding: 0px 5px 0px 5px;
z-index: 12;
position: relative;
margin-top: -2px;
}
.searchautocomplete button.button {
width: 100px;
border-radius: 0;
-webkit-border-radius: 0;
-moz-border-radius: 0;
-webkit-border-top-right-radius: 5px;
-webkit-border-bottom-right-radius: 5px;
-moz-border-radius-topright: 5px;
-moz-border-radius-bottomright: 5px;
border-top-right-radius: 5px;
border-bottom-right-radius: 5px;
}
.searchautocomplete button.button, button.button.btn-cart {
background: #0085fb;
color: #ffffff;
border: 1px solid #0085fb;
font: bold 12px/1.35 Helvetica, Arial, sans-serif;
border-radius: 3px;
-webkit-border-radius: 3px;
-moz-border-radius: 3px;
}
.searchautocomplete .searchautocomplete-loader {
position: absolute;
top: 6px;
right: 10px;
width: 16px;
height: 16px;
background: url('../../../images/mirasvit/loader.gif');
}
.searchautocomplete .searchautocomplete-placeholder {
-webkit-border-radius: 5px 5px 5px 5px;
-moz-border-radius: 5px 5px 5px 5px;
border-radius: 5px 5px 5px 5px;
background: #FFF;
border: 1px solid #ccc;
padding: 15px 10px 5px 10px;
margin-top: 45px;
width: 100%;
z-index: 102;
position: absolute;
}
.searchautocomplete .nav .nav-search-in {
position: relative;
float: left;
top: -3px;
left: -3px;
z-index: 15;
}
.searchautocomplete .nav .nav-search-in .category-fake {
-webkit-border-radius: 5px 0px 0px 5px;
-moz-border-radius: 5px 0px 0px 5px;
border-radius: 5px 0px 0px 5px;
background-color: #fcfcfc;
background-image: -moz-linear-gradient(top, #ffffff, #f7f7f7);
background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#ffffff), to(#f7f7f7));
background-image: -webkit-linear-gradient(top, #ffffff, #f7f7f7);
background-image: -o-linear-gradient(top, #ffffff, #f7f7f7);
background-image: linear-gradient(to bottom, #ffffff, #f7f7f7);
background-repeat: repeat-x;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffffff', endColorstr='#fff7f7f7', GradientType=0);
border-right: 1px solid #dddddd;
color: #777;
cursor: pointer;
float: left;
font: normal 17px/1.35 Arial, Helvetica, sans-serif;
height: 27px;
line-height: 27px;
margin: 4px 0px 0px 2px;
padding: 0px 25px 0px 10px;
text-align: center;
white-space: nowrap;
}
.searchautocomplete .nav .nav-search-in .nav-down-arrow {
background: url('../../../images/mirasvit/sprite.png');
width: 9px;
height: 5px;
background-position: -26px -34px;
display: block;
right: 10px;
top: 16px;
position: absolute;
}
.searchautocomplete .nav .nav-search-in .category {
opacity: 0;
filter: alpha(opacity=0);
background: white;
border: 1px solid #DDD;
color: black;
cursor: pointer;
height: 29px;
left: 5px;
margin: 0;
outline: 0;
padding: 0;
position: absolute;
top: 5px;
visibility: visible;
width: auto;
}
JSFiddle might come in handy:
http://jsfiddle.net/V4ZH9/
This search bar driving me nutz please help spent many hours fixing it but I'm just new to CSS and the more I change the code the worse it works

span inside div with .before bugs with IE 10

I use span inside div to simulate whole div as a link. It works well on Chrome & FF, but in IE, it doesn't.
I use an imported font (awesome font) to make appear an icon on the main div (with "before" statement in css). The div appears to be clickable just a little before and just a little after the icon. In FF and Chrom, the whoole icon is clickable... How to make it work in IE?...
css:
.tiremenuadmin{
font-family: 'fontawesome';
display: block;
font-size: 30px;
text-shadow: 0px 0px 7px #000000;
padding: 7px;
float: right;
width: 46px;
text-align: center;
margin: 7px 7px 0 0;
background-color: #364f71;
-webkit-border-radius: 0 0 6px 6px;
-moz-border-radius: 0 0 6px 6px;
border-radius: 0 0 6px 6px;
border-bottom: 1px solid #000;
border-right: 1px solid #000;
border-left: 1px solid #000;
box-shadow: 0px 0px 10px 0px rgba(0,0,0,1);
-webkit-box-shadow: 0px 0px 10px 0px rgba(0,0,0,1);
-moz-box-shadow: 0px 0px 10px 0px rgba(0,0,0,1);
cursor: pointer;
opacity: 0.7;
}
.tiremenuadmin:before{
content: "\F013";
}
.menuadmin{
position: relative;
display: block;
width: 100%;
height: 50px;
font-size: 24px;
font-weight: bold;
color: #677889;
text-shadow: 1px 1px 0 #FFFFFF;
}
.enveloppe_menuadmin{
left: 50%;
margin-left: -10px;
margin-top: -70px;
width: 486px;
height: 50px;
position: fixed;
background: #364f71;
z-index: 100;
padding: 10px 12px 10px 10px;
-webkit-border-radius: 0 0 6px 6px;
-moz-border-radius: 0 0 6px 6px;
border-radius: 0 0 6px 6px;
border-bottom: 1px solid #000;
border-right: 1px solid #000;
border-left: 1px solid #000;
box-shadow: 0px 0px 10px 0px rgba(0,0,0,1);
-webkit-box-shadow: 0px 0px 10px 0px rgba(0,0,0,1);
-moz-box-shadow: 0px 0px 10px 0px rgba(0,0,0,1);
}
.align_menuadmin{
left: -50%;
}
.cover_admin{
background: #364f71;
float: right;
width: 79px;
height: 8px;
left: 418px;
position: absolute;
}
.env_menuadmin{
width:100%;
-webkit-border-radius: 6px;
-moz-border-radius: 6px;
border-radius: 6px;
background: #f3f3f3;
border-top: 1px solid #fff;
border-left: 1px solid #fff;
border-right: 1px solid #d6d6d6;
border-bottom: 1px solid #d6d6d6;
}
.adminmenu, .adminmenu_0, .adminmenu_1, .adminmenu_2, .adminmenu_3, .adminmenu_4, .adminmenu_5, .adminmenu_6, .adminmenu_7{
position: relative;
float: left;
height: 21px;
padding: 14px 15px 15px 15px;
font-family: 'fontawesome';
}
.adminmenu_00{
position: relative;
float: left;
height: 21px;
padding: 14px 15px 15px 15px;
font-family: 'fontello-home';
font-size: 21px;
top: 1px;
}
.adminmenu_0, .adminmenu_1, .adminmenu_2, .adminmenu_3, .adminmenu_5, .adminmenu_6, .adminmenu_7 {
border-left:1px solid #fff;
border-right:1px solid #d6d6d6;
}
.adminmenu_00{
border-right:1px solid #d6d6d6;
}
.adminmenu_4{
border-left:1px solid #fff;
}
.adminmenu_0:before{
content: "\F007";
}
.adminmenu_00:before{
content: "\E0E0";
}
.adminmenu_1:before{
content: "\F085";
}
.adminmenu_2:before{
content: "\F0E0";
}
.adminmenu_3:before{
content: "\F059";
}
.adminmenu_4:before{
content: "\F011";
}
.adminmenu_5:before{
content: "\F0C1";
}
.adminmenu_6:before{
content: "\F15C";
}
.adminmenu_7:before{
content: "\F055";
}
.adminmenu_1 span, .adminmenu_2 span, .adminmenu_3 span, .adminmenu_4 span, .adminmenu_5 span, .adminmenu_6 span, .adminmenu_7 span, .adminmenu_0 span, .adminmenu_00 span {
position: absolute;
width: 100%;
height: 50px;
right: 0px;
top: 0;
z-index: 1000;
}
.adminmenu:hover, .adminmenu_00:hover, .adminmenu_0:hover, .adminmenu_1:hover, .adminmenu_6:hover, .adminmenu_7:hover, .adminmenu_2:hover, .adminmenu_3:hover, .adminmenu_4:hover, .adminmenu_5:hover{
color:#7D92A7;
}
html:
<div class="enveloppe_menuadmin" style="opacity: 1; margin-top: -15px;">
<div class="align_menuadmin">
<div class="env_menuadmin">
<div class="menuadmin">
<div class="adminmenu_00"><span></span></div>
<div class="adminmenu_0"><span></span></div>
<div class="adminmenu_1"><span></span></div>
<div class="adminmenu_5"><span></span></div>
<div class="adminmenu_2"><span></span></div>
<div class="adminmenu_6"><span></span></div>
<div class="adminmenu_7"><span></span></div>
<div class="adminmenu_3"><span></span></div>
<div class="adminmenu_4"><span></span></div>
</div>
</div>
<div class="tiremenuadmin" style="opacity: 1;"></div>
<div class="cover_admin"></div>
</div>
</div>
Demo: http://jsfiddle.net/namkc/
Found:
<div class="adminmenu_00"><span></span></div>

Resources