Reputation: 116
Please see this jsfiddle
HTML:
<body>
<header>
<div id="top-header">
<div id="search-div">
<form method="get" name="search">
<input value="Search" id="search-button" type="submit">
<input name="term" id="search-box" type="search">
<div id="search-options">
<ul>
<li id="search-option-icon">0</li>
<li>1</li>
<li>2</li>
<li>3</li>
<li>4</li>
<li>5</li>
</ul>
<input name="search-type" id="search-type" type="hidden">
</div>
</form>
</div>
</div>
<div id="bottom-header">something here</div>
</header>
</body>
CSS:
*{
margin:0;
padding:0;
font-size:100%;
border:0 none;
}
body{
direction: rtl;
}
header{
position:relative;
width:100%;
height: 80px;
}
/*
--------------------------------------------------------
| header
--------------------------------------------------------
*/
header > div{
width: 100%;
position:relative;
position: relative;
}
#top-header{
background: #9600ee;
height: 52px;
}
#bottom-header{
background: white;
height: 29px;
border-bottom: 1px solid #d5d5d5;
box-shadow:0 1px 1px #e0e0e0;
}
#img-logo{
display: inline-block;
}
/*
--------------------------------------------------------
| header > search-div
--------------------------------------------------------
*/
#search-div{
width:432px;
position: absolute;
top:8px;
height: 36px;
left:0;
right:0;
margin:auto;
z-index: 3;
}
#search-options{
height: 36px;
width: 49px;
background: #FFFFFF;
background: linear-gradient(#FFFFFF,#e6e6e6);
text-align: center;
display: inline-block;
vertical-align: middle;
cursor: pointer;
left:0;
}
#search-options > ul > li{
display: none;
}
#search-option-icon{
display: block !important;
}
#search-options:hover > ul > li{
width: 49px;
background: red;
display: block;
}
#search-box{
display: inline-block;
height: 36px;
width: 325px;
right:49px;
padding:0 5px;
border-right:1px solid #9600ee;
border-left: 1px solid #d1d1d1;
}
#search-button{
height: 100%;
width: 48px;
background: #FFFFFF;
background: linear-gradient(#FFFFFF,#e6e6e6);
border-radius: 0 2px 2px 0;
}
I am going to create a page that its direction is Right to Left. I don't know why Firefox is showing a different result then other browsers?
What I see in Chrome:
What Firefox shows(Firefox 37):
What is the problem? And why is Firefox (or my Firefox) showing a different result?
Upvotes: 0
Views: 111
Reputation: 40842
Input elements are rendered depending on the browsers and OS with a different appearance. Chrome seems to apply box-sizing: border-box;
to an input element as soon as you change the type
to search
, but Firefox doesn't do that (currently I would say that Firefox is right about that but I need to check this in the specs).
Firefox does not change the box-sizing
for those elements and because the default box-sizing
is content-box
, the complete outer-width is width
+ padding
+ border
(for more details you can look here CSS-Tricks: Box Sizing). As of that your #search-box
in Firefox does not have an outer-width of 325px
.
If you want to have better control about the outer-width of the elements you need to use border-box
for box-sizing
. You can change the box-sizing
for your whole page using :
html {
box-sizing: border-box;
}
*, *:before, *:after {
box-sizing: inherit;
}
Code from site: Paul Irish: * { Box-sizing: Border-box } FTW
Updated jsfiddle using border-box
.
Upvotes: 1
Reputation: 570
Your #search-div is too narrow, making the elements crammed together. Your search divs are also out of order. I would suggest arranging them in the order of search-options, search-box, search-button, then adding float: left; to each of their styles as well as some margin-left: 20px; so they aren't right next to each other.
Your search-box also has a small width cutting off letters.
See this jsfiddle: http://jsfiddle.net/3qzb7q0d/1/
Something like:
#search-options {
display: inline-block;
float: left;
margin-left: 20px;
// whatever else
}
Add that to each search portion.
Increase the width of #search-button
Remove the width from #search-div
Upvotes: 1