how do i make the search box in the center of the nav bar? you will see what i mean below with the image.. ill post my css code for the search box below the image ..
#advsearch {
}
#advsearch input[type="text"] {
background: url(/images/search-dark.png) no-repeat 10px 6px #444;
border: 0 none;
font: bold 12px Arial, Helvetica, Sans-serif;
color: #777;
width: 150px;
padding: 6px 15px 6px 35px;
-webkit-border-radius: 20px;
-moz-border-radius: 20px;
border-radius: 20px;
text-shadow: 0 2px 2px rgba(0, 0, 0, 0.3);
-webkit-box-shadow: 0 1px 0 rgba(255, 255, 255, 0.1), 0 1px 3px rgba(0, 0, 0, 0.2) inset;
-moz-box-shadow: 0 1px 0 rgba(255, 255, 255, 0.1), 0 1px 3px rgba(0, 0, 0, 0.2) inset;
box-shadow: 0 1px 0 rgba(255, 255, 255, 0.1), 0 1px 3px rgba(0, 0, 0, 0.2) inset;
-webkit-transition: all 0.7s ease 0s;
-moz-transition: all 0.7s ease 0s;
-o-transition: all 0.7s ease 0s;
transition: all 0.7s ease 0s;
}
#advsearch input[type="text"]:focus {
width: 200px;
}
thanks so much in advance :) if u want maybe we can work on my website together?
also here is a Js Fiddle just incase you need it dont mind the images not being there it should not make a diffrence
Here you need to modify some css code.
#cssmenu > ul > li > a {
color: #A0A0A0;
font-family: Verdana,'Lucida Grande';
font-size: 15px;
/*line-height: 70px;
padding: 0;*/
position: relative;
top: 7px;
transition: color 0.15s ease 0s;
}
Demo: http://jsfiddle.net/y5Fhc/8/
anchor in not needed in the li of search box and I have added a class in the li of search box to make it center of the nav bar.
css
li.search{
line-height:40px;
}
html
<li class='active search'><span>
<form method="get" action="/search" id="advsearch">
<input name="q" type="text" size="40" placeholder="Search..." />
</form>
</li>
jsFiddle File
Related
Is it possible to have a radio button use text to toggle without using id's or javascript? Could you use the 'class' tag instead? This is not a "you should use javascript or id's", but instead a is it possible to do this without them. Any help would be appreciated in resolving this.
Absolutely! There's nothing stopping you from using class selectors instead of ID selectors.
Here's a simple radio button that toggles text. It uses pure CSS, and makes use of classes:
.switch-field {
font-family: "Lucida Grande", Tahoma, Verdana, sans-serif;
padding: 40px;
overflow: hidden;
}
.switch-title {
margin-bottom: 6px;
}
.switch-field input {
position: absolute !important;
clip: rect(0, 0, 0, 0);
height: 1px;
width: 1px;
border: 0;
overflow: hidden;
}
.switch-field label {
float: left;
}
.switch-field label {
display: inline-block;
width: 60px;
background-color: #e4e4e4;
color: rgba(0, 0, 0, 0.6);
font-size: 14px;
font-weight: normal;
text-align: center;
text-shadow: none;
padding: 6px 14px;
border: 1px solid rgba(0, 0, 0, 0.2);
-webkit-box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.3), 0 1px rgba(255, 255, 255, 0.1);
box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.3), 0 1px rgba(255, 255, 255, 0.1);
-webkit-transition: all 0.1s ease-in-out;
-moz-transition: all 0.1s ease-in-out;
-ms-transition: all 0.1s ease-in-out;
-o-transition: all 0.1s ease-in-out;
transition: all 0.1s ease-in-out;
}
.switch-field label:hover {
cursor: pointer;
}
.switch-field input:checked + label {
background-color: #A5DC86;
-webkit-box-shadow: none;
box-shadow: none;
}
.switch-field label:first-of-type {
border-radius: 4px 0 0 4px;
}
.switch-field label:last-of-type {
border-radius: 0 4px 4px 0;
}
<form class="form">
<div class="switch-field">
<div class="switch-title">Is this awesome?</div>
<input type="radio" id="switch_left" name="switch_2" value="yes" checked/>
<label for="switch_left">Yes</label>
<input type="radio" id="switch_right" name="switch_2" value="no" />
<label for="switch_right">No</label>
</div>
</form>
Hope this helps! :)
I am trying to figure out why it can not align correctly. I have tried: display, align changing the margins, changing the padding, changing the position. event the top or doing a float on it.
Photo of what it looks like
.headerMenu {
background-color: #272626;
Height: 56px;
border-bottom: 0px;
padding-left: auto;
padding-right: auto;
width: 100%;
}
#wrapper {
margin-left: auto;
margin-right: auto;
width: 1000px;
padding-top: 0px;
padding-bottom: 0px;
}
.logo {
padding-top: 9px;
padding-bottom: 9px;
width: 38px;
transition-timing-function: linear;
transition: all 2s;
}
.logo .img {
background-image: url(../img/logo-white-p.png);
width: 38px;
height: 38px;
transition-timing-function: linear;
transition: all 0.5s;
}
.logo:hover {
background-color: rgba(255, 255, 255, 1.00);
}
.logo .img:hover {
background-image: url(../img/logo-black-p.png);
}
.search_box {
position: absolute;
top: 13px;
margin-left: 155px;
}
#search input[type="text"] {
background: url(../img/search-icon-white.png) no-repeat 10px 6px #000;
outline: none;
border: 0 none;
font: bold 12px;
color: #fff;
width: 350px;
padding: 6px 15px 6px 35px;
text-shadow: 0 2px 2px rgba(255, 255, 255, 0.30);
-webkit-box-shadow: 0 1px 0 rgba(255, 255, 255, 0.1), 0 1px 3px rgba(0, 0, 0, 0.2) inset;
-moz-box-shadow: 0 1px 0 rgba(255, 255, 255, 0.1), 0 1px 3px rgba(0, 0, 0, 0.2) inset;
-box-shadow: 0 1px 0 rgba(255, 255, 255, 0.1), 0 1px 3px rgba(0, 0, 0, 0.2) inset;
-webkit-transition: all 0.7s ease 0s;
-moz-transition: all 0.7s ease 0s;
-o-transition: all 0.7s ease 0s;
-transition: all 0.7s ease 0s;
}
#search input[type="text"]:focus {
background: url(../img/search-icon.png) no-repeat 10px 6px #fff;
color: #6a6f75;
width: 350px;
-webkit-box-shadow: 0 1px 0 rgba(255, 255, 255, 0.1), 0 1px 0 rgba(0, 0, 0, 0.9) inset;
-moz-box-shadow: 0 1px 0 rgba(255, 255, 255, 0.1), 0 1px 0 rgba(0, 0, 0, 0.9) inset;
-box-shadow: 0 1px 0 rgba(255, 255, 255, 0.1), 0 1px 0 rgba(0, 0, 0, 0.9) inset;
text-shadow: 0 2px 3px rgba(0, 0, 0, 0.1);
}
#media screen and (max-width: 1280px) {
#menu {
postion: absolute;
top: 0px;
right0px;
height: 37px;
padding-top: 19px;
}
}
#menu a {
color: #000;
text-decoration: none;
font-size: 14px;
padding-top: 19px;
padding-bottom: 22px;
padding-left: 10px;
padding-right: 10px;
}
#menu a:hover {
border-bottom: 2px solid #000000;
}
<div class="headerMenu">
<div id="wrapper">
<div class="logo">
<div class="img"></div>
</div>
<div class="serch_box">
<form action="serch.php" method="get" id="search">
<input type="text" name="q" size="60px" placeholder="Search..." />
</form>
</div>
<div id="menu">
Home
About
Login
Register
</div>
</div>
</div>
Your problem lies in the fact that a div element is a block element and therefore forces itself to a new line.
If we tell the system to make each div under the #wrapper to be an inline element, then it will all line up as expected.
It also requires vertical-align: middle to make everything align to the middle of the header. If this isn't present then it sets it to the bottom of the header element.
.headerMenu {
background-color: #272626;
Height: 56px;
border-bottom: 0px;
padding-left: auto;
padding-right: auto;
width: 100%;
}
#wrapper {
margin-left: auto;
margin-right: auto;
width: 1000px;
padding-top: 0px;
padding-bottom: 0px;
}
div#wrapper > div {
display: inline-block;
vertical-align: middle;
}
.logo {
padding-top: 9px;
padding-bottom: 9px;
width: 38px;
transition-timing-function: linear;
transition: all 2s;
}
.logo .img {
background-image: url(../img/logo-white-p.png);
width: 38px;
height: 38px;
transition-timing-function: linear;
transition: all 0.5s;
}
.logo:hover {
background-color: rgba(255, 255, 255, 1.00);
}
.logo .img:hover {
background-image: url(../img/logo-black-p.png);
}
.search_box {
position: absolute;
top: 13px;
margin-left: 155px;
}
#search input[type="text"] {
background: url(../img/search-icon-white.png) no-repeat 10px 6px #000;
outline: none;
border: 0 none;
font: bold 12px;
color: #fff;
width: 350px;
padding: 6px 15px 6px 35px;
text-shadow: 0 2px 2px rgba(255, 255, 255, 0.30);
-webkit-box-shadow: 0 1px 0 rgba(255, 255, 255, 0.1), 0 1px 3px rgba(0, 0, 0, 0.2) inset;
-moz-box-shadow: 0 1px 0 rgba(255, 255, 255, 0.1), 0 1px 3px rgba(0, 0, 0, 0.2) inset;
-box-shadow: 0 1px 0 rgba(255, 255, 255, 0.1), 0 1px 3px rgba(0, 0, 0, 0.2) inset;
-webkit-transition: all 0.7s ease 0s;
-moz-transition: all 0.7s ease 0s;
-o-transition: all 0.7s ease 0s;
-transition: all 0.7s ease 0s;
}
#search input[type="text"]:focus {
background: url(../img/search-icon.png) no-repeat 10px 6px #fff;
color: #6a6f75;
width: 350px;
-webkit-box-shadow: 0 1px 0 rgba(255, 255, 255, 0.1), 0 1px 0 rgba(0, 0, 0, 0.9) inset;
-moz-box-shadow: 0 1px 0 rgba(255, 255, 255, 0.1), 0 1px 0 rgba(0, 0, 0, 0.9) inset;
-box-shadow: 0 1px 0 rgba(255, 255, 255, 0.1), 0 1px 0 rgba(0, 0, 0, 0.9) inset;
text-shadow: 0 2px 3px rgba(0, 0, 0, 0.1);
}
#media screen and (max-width: 1280px) {
#menu {
postion: absolute;
top: 0px;
right0px;
height: 37px;
padding-top: 19px;
}
}
#menu a {
color: white;
text-decoration: none;
font-size: 14px;
padding-top: 19px;
padding-bottom: 22px;
padding-left: 10px;
padding-right: 10px;
}
#menu a:hover {
border-bottom: 2px solid #000000;
}
<div class="headerMenu">
<div id="wrapper">
<div class="logo">
<div class="img"></div>
</div>
<div class="serch_box">
<form action="serch.php" method="get" id="search">
<input type="text" name="q" size="60px" placeholder="Search..." />
</form>
</div>
<div id="menu">
Home
About
Login
Register
</div>
</div>
</div>
I´m trying to put an icon font inside my search input at the right side.
I´m putting the icon font <i class="fa fa-search-plus"></i> inside my <button> tag, but the icon font is appearing at the right of my search input and not inside the input at right.
Somebody there can see what is happening?
My jsfiddle with the problem:
http://jsfiddle.net/ritz/ZNb5r/ (I try to link the "font-awesome.min.css" into the jsfiddle but I think its not working)
My html:
<li style="float:right; list-style:none; height:20px;">
<form id="search">
<input name="q" type="text" size="40" placeholder="Search..." />
<button type="submit"><i class="fa fa-search-plus"></i></button>
</form>
</li>
My css:
#search
{
margin-top:8x;
margin-top:8px;
outline:none ;
border:none ;
}
#search input[type="text"]
{
border: 0 none;
font: 12px 'verdana';
background: brown;
text-indent: 0;
width:110px;
padding: 6px 15px 6px 35px;
-webkit-border-radius: 20px;
-moz-border-radius: 20px;
border-radius: 20px;
text-shadow: 0 2px 2px rgba(0, 0, 0, 0.3);
-webkit-box-shadow: 0 1px 0 rgba(255, 255, 255, 0.1), 0 1px 3px rgba(0, 0, 0, 0.2) inset;
-moz-box-shadow: 0 1px 0 rgba(255, 255, 255, 0.1), 0 1px 3px rgba(0, 0, 0, 0.2) inset;
box-shadow: 0 1px 0 rgba(255, 255, 255, 0.1), 0 1px 3px rgba(0, 0, 0, 0.2) inset;
-webkit-transition: all 0.7s ease 0s;
-moz-transition: all 0.7s ease 0s;
-o-transition: all 0.7s ease 0s;
transition: all 0.7s ease 0s;
}
#search input[type="text"]:focus
{
background: #141d22;
color: #fff;
width: 170px;
outline:none;
color:000;
-webkit-box-shadow: 0 1px 0 rgba(255, 255, 255, 0.1), 0 1px 0 rgba(0, 0, 0, 0.9) inset;
-moz-box-shadow: 0 1px 0 rgba(255, 255, 255, 0.1), 0 1px 0 rgba(0, 0, 0, 0.9) inset;
box-shadow: 0 1px 0 rgba(255, 255, 255, 0.1), 0 1px 0 rgba(0, 0, 0, 0.9) inset;
text-shadow: 0 2px 3px rgba(0, 0, 0, 0.1);
}
button[type="submit"]>i:hover
{
color: #fff;
}
button[type="submit"]>i
{
background:none;
color:#ccc;
font-size:1.5em;
}
The icon will not appear inside your input, because your button is not and can not be nested inside an input.
To make your button appear inside the input, try this:
<style type="text/css">
* {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
#search input[type="text"] {
padding-right: 20px;
}
#search button[type="submit"] {
margin-left: -20px;
width: 20px;
}
</style>
You may have to tweak margins and paddings to get it to work properly. To eliminate some trouble, I've added box sizing. Why?
[By default] The width and height properties are measured including only the content, but not the border, margin, or padding.
When you use border-box, however,
The width and height properties include the padding and border, but not the margin.
(See MDN's article on box-sizing: https://developer.mozilla.org/en-US/docs/Web/CSS/box-sizing)
You just aren't linking to the font-awesome css file correctly. Here is my fiddle with it working properly.
To make it work all I did was link it to the CDN by adding this http://www.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css to external resources.
Put some height and width in the button tag should sholve your issue. Then make an icon as background-image. You may not have to put i tag on it, see my Fiddle using an input tag and background-image as icon.
So in my bootstrap.css I have:
.form-control {
display: block;
width: 100%;
height: 34px;
padding: 6px 12px;
font-size: 14px;
line-height: 1.428571429;
color: #555555;
vertical-align: middle;
background-color: #ffffff;
border: 1px solid #cccccc;
border-radius: 4px;
-webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
-webkit-transition: border-color ease-in-out 0.15s, box-shadow ease-in-out 0.15s;
transition: border-color ease-in-out 0.15s, box-shadow ease-in-out 0.15s;
}
And in my own .css file that I loaded after bootstrap.css:
.form-control {
display: block;
width: 100%;
height: 45px;
padding: 6px 12px;
font-size: 27px;
line-height: 1.928571429;
color: #555555;
vertical-align: left;
background-color: #002b36;
border: 0px none #002b36;
border-radius: 4px;
-webkit-box-shadow: none 0 0px 1px rgba(0, 0, 0, 0.075);
box-shadow: none 0 0px 1px rgba(0, 0, 0, 0.075);
-webkit-transition: border-color ease-in-out 0.15s, box-shadow ease-in-out 0.15s;
transition: border-color ease-in-out 0.15s, box-shadow ease-in-out 0.15s;
}
Everything is overwritten except for the
-webkit-box-shadow: none 0 0px 1px rgba(0, 0, 0, 0.075);
box-shadow: none 0 0px 1px rgba(0, 0, 0, 0.075);
I can tell since if I change that snippet in bootstrap.css to match what I have in my own css file that it actually changes on the webpage. So for some reason, my own css overwrites everything except for those two lines about box-shadows, and I don't know why.
Try shorten it to valid CSS like:
-webkit-box-shadow: none;
box-shadow: none;
I made a form for a site and all textboxes have rounded corners except the select drop down box. I made a rounded box style and it shows but the original square also shows behind it. Is there any way I can remove this so my is the only one that shows. I'll add the code
<td>Service Requested:
<select style="margin-left: 10px" name="service" tabindex="4">
<option value=" " selected="selected"> </option>
<option value="Residential Move">Residential Move*</option>
<option value="Commercial Move">Commercial Move*</option>
<option value="Storage Unit Loading">Storage Unit Loading</option>
<option value="Storage Unit Unloading">Storage Unit Unloading</option>
<option value="Furniture Consignment">Furniture Consignment</option>
<option value="Assembly/Removal">Assembly/Removal</option>
<option value="Landscaping">Landscaping</option>
<option value="Cleanout">Cleanout</option>
<option value="General Help">General Help</option>
</select>
</td>
and this is the entire css for the whole form. Just have at it
#searchbox {
padding-left: 190px;
padding-bottom:40px;
background: url(../images/border-dashed.gif) repeat-x left bottom;
}
#searchbox form {
margin: 0;
}
#searchbox table {
margin: 0;
}
#searchbox th, td {
text-align: left;
font-weight: normal;
color:#302f2f;
}
#searchbox .submitrow {
text-align: right;
}
#search {
}
#search input[type="text"] {
border: 2px solid #c1c2c3 ;
font: bold 12px Arial,Helvetica,Sans-serif;
color: #302f2f;
width: 100px;
padding: 6px 15px 6px 15px;
-webkit-border-radius: 20px;
-moz-border-radius: 20px;
border-radius: 20px;
text-shadow: 0 2px 3px rgba(0, 0, 0, 0.1);
-webkit-box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15) inset;
-moz-box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15) inset;
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15) inset;
-webkit-transition: all 0.7s ease 0s;
-moz-transition: all 0.7s ease 0s;
-o-transition: all 0.7s ease 0s;
transition: all 0.7s ease 0s;
}
#search input[type="text"]:focus {
width: 150px;
}
#search select {
border: 2px solid #c1c2c3 ;
font: bold 12px Arial,Helvetica,Sans-serif;
color: #302f2f;
width: 200px;
padding: 6px 15px 6px 15px;
-webkit-border-radius: 20px;
-moz-border-radius: 20px;
border-radius: 20px;
text-shadow: 0 2px 3px rgba(0, 0, 0, 0.1);
-webkit-box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15) inset;
-moz-box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15) inset;
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15) inset;
-webkit-transition: all 0.7s ease 0s;
-moz-transition: all 0.7s ease 0s;
-o-transition: all 0.7s ease 0s;
transition: all 0.7s ease 0s;
}
#search select:focus {
width: 250px;
}
#search textarea {
border: 2px solid #c1c2c3 ;
font: bold 12px Arial,Helvetica,Sans-serif;
color: #302f2f;
width: 300px;
padding: 6px 15px 6px 15px;
-webkit-border-radius: 20px;
-moz-border-radius: 20px;
border-radius: 20px;
text-shadow: 0 2px 3px rgba(0, 0, 0, 0.1);
-webkit-box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15) inset;
-moz-box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15) inset;
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15) inset;
-webkit-transition: all 0.7s ease 0s;
-moz-transition: all 0.7s ease 0s;
-o-transition: all 0.7s ease 0s;
transition: all 0.7s ease 0s;
}
#search textarea:focus {
}
.contactwrapper {width:auto; height:200px; overflow:hidden;}
.extra-wrap {width:800px; overflow:hidden;}
.formbtn {
background: url(../images/formbtns.png) no-repeat;
background-position: 0 bottom;
color: #f1f2ea;
display: block;
line-height: 28px;
float:right;
margin-left:450px;
margin-bottom:40px;
height: 30px;
width: 100px;
margin: 48px 10px;
outline: 0;
text-align: center;
text-decoration: none;
}
.formbtn:hover {
background-position: 0 top;
}
thanks
The ability to style select boxes is inconsistent across browsers. Some of them respond well to CSS styling and some don't, but if you really want to have completely consistent control over it and its behavior, you need to make a faux-select that is powered by javascript.
Check out the Select2 control, it's nice.
Styling to a select box is chosen mostly by the browser and is not very customizable without javascript besides using a background image.
Since jQuery UI 1.8 there has been an autocomplete control that has a combobox functionality which replaces a select control.
I found an alternative, but not sure how it will behave with all browsers. But if you change the border property to inherit it will do it. At least in Chrome
border: 2px inherit #c1c2c3 ;