Cursor position wrong in Firefox input element (searchbox) - firefox

I'm having trouble with the cursor in a searchbox that displays too far left in Firefox, whereas it looks fine in Chrome and Safari. The CSS uses Modernizr to display a borderradius where possible, so the issue doesn't concern IE which is served a plain square box.
Here's the HTML:
<form action="/search-results/" id="search" role="search">
<input type="search" placeholder="Search this site here" name="q" results=5 id="q" autocomplete="off" size="31"/>
</form>
The CSS is as follows:
input::-webkit-input-placeholder {
color: #999;
}
input:-moz-placeholder {
color: #999;
to display the placeholder and
.borderradius #search input#q {
width: 180px;
height: 20px;
font: 11px "Helvetica Neue", Arial, Helvetica, Geneva, sans-serif;
margin: 0;
padding: 0;
background: #fcfcfc;
border: 1px solid #d1d1d1;
-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;
}
.no-borderradius #search input#q {
border: 1px solid #ccc;
background: #eee;
font: inherit;
width: 170px;
height: 20px;
padding: 0 0 0 8px
}
to style the box.
I also added this:
/* Remove default input type="search styling */
input[type="search"] {
-webkit-appearance: textfield; /* You could also use none */
}
(which I saw in this article) which has the effect of removing the 'enforced' styling of the Webkit search box—meaning it can then be made to render consistently in Mozilla with the right styling.
Adding the results=5attribute in the input tag, although it doesn't currently validate, displays a magnifying glass in Webkit.
The above code can also be checked online on my site.
The search box displays as follows:
Safari
Chrome
Firefox
Firefox doesn't display the magnifying glass, but that's fine. On the other hand, while adjusting the margin and/or padding on the box can correct the wrong (too far left) Firefox cursor display, it necessarily does so at the (unacceptable) cost of pushing it too far right in Webkit browsers. And I haven't found a way of targeting just Mozilla in this instance. Any suggestions welcome...

To be fair, Firefox isn't displaying the wrong cursor position. If you remove the invalid results attribute, you will see the cursor position is in the same place in webkit.
I am not sure what padding/margins you have tried, but the padding below looked fine in both browsers. The box-sizing: properties are used so that the input acts the same way in all browsers and doesn't make the box bigger with the extra padding.
.borderradius #search input#q{
padding: 0 0 0 6px;
-webkit-box-sizing: padding-box;
-moz-box-sizing: padding-box;
box-sizing: padding-box;
}

This is complex - it seems to me that we've some way to go before native styling of the new form elements works well cross-browser. I have put together a fiddle which shows the code necessary to display your search input properly in both webkit browsers and Firefox.
This article by Trent Walton describes the various properties that affect the appearance of search inputs, and the always brilliant CSS Tricks also has some useful information.
Basically, I've over-ruled the browser's native styling using this code:
-moz-appearance: none;
-webkit-appearance: none;
I've then used the -moz-padding-start property (who knew?) to add some left padding only for Firefox.
So, although that works, it is far from ideal having to jump through those hoops. A note on #tw16's answer: -moz-box-sizing is currently used by even the most recent version of Firefox, but is likely to be replaced by the non-prefixed version in future, which will potentially break that solution. To be fair, -moz-padding-start will presumably be similarly replaced at some point in the future, though the CSS Writing Module seems more obscure (to me at least).

Related

Border-radius bug in firefox

I've some problem with border-radius function in firefox.
When i apply, it makes some kind of space, or border around the item.
Can somebody tell me that this is a firefox bug or is there some resolve for that?
Here is the problem:
JsFiddle
The
border-radius:50%;
line makes that, i am sure.
Seems to me that this is a FF issue at rendering shadows with border-radius.
You could try this simple trick :
The demo
Basically, you apply the grey shadow on the parent li, make it a bit finer and then move a bit the a.ch-item child in order to make it go over the gap.
.ch-grid > li {
box-shadow: 0px 0px 5px 15px rgba(255, 255, 255, 0.6);
border-radius: 50%;
width: 198px;
height: 198px;
}
.ch-item {
position: relative;
top: -1px;
left: -1px;
}
Of course, this is just for the idea. You might also want to apply the hover effect on the li element itself and move it 1px down and right to have a better result.
Edit : a better result

White corner showing on black box with Border-radius

I am getting a odd effect (currently in chrome). I have created my own overlay dialog box. which has a semi transparent background sitting on top of my website with a box on top of that. the top of the bar as you can see has a black background. The main part of the box is white thought.
Its not the easyist to see but it is annoying me.
The white is showing through from behind. (I know as if i change it to red it changes colour) Which you can see in the top right hand corner of the screenshots, just above the "X"
Both the header and the box has a border radius 3px
.blockUI .overlay {
background: #f00;
border-radius: 3px;
margin: 0 auto;
padding: 10px;
overflow: hidden;
position: relative;
top: 20%;
text-align: inherit;
width: 600px;
z-index: 10009;
}
blockUI .overlay h1 {
background: #000;
border-bottom: 2px solid #F48421;
border-radius: 3px 3px 0 0;
color: #FFF;
font-family: 'Roboto', sans-serif;
font-weight: 300;
margin: -10px;
padding: 10px;
}
Since overflow: hidden; along with border-radius seems to cause some rendering inconsistencies in some engines (take a look at this), one should use border-radius on both the parent and the child elements to achieve rounded corners.
As you have noticed, you still get some wierd results with extra pixels "shining" through. Just reduce the border-radius of the child (or the other way round) to compensate this.
blockUI .overlay h1 {
border-radius: 2px 2px 0 0;
}
I had same problem. But I solved.
.blockUI .overlay {background:#000;}
and remake some!
You should try on the parent div:
-webkit-background-clip: padding-box;
Finally fixed this completely by adding this on parent and child divs.
-webkit-perspective: 1000;
-webkit-backface-visibility: hidden;
-webkit-transform: translate3d(0,0,0);
outline:none;
border:none;
text-decoration:none;

Frameset makes dropdown invisible

I use framesets (I know, that is very very bad :)) and that works for me, but I have one little problem: the frameset does not allow me to see the dropdown box that I have made. It just shows one list item and the other 4 items are invisible. If I enlarge the frameset, then it will show up, but that is not a solution because the site won't be the way I want it to be (it goes to the bottom).
This is the frameset: frameset id="f" border="0" rows="50" and this is the css of the dropdown menu:
.dropdown .dropdown-menu {
background-color: #ECECEC;
border: 1px solid #D9D9D9;
border-radius: 3px 3px 3px 3px;
box-shadow: 0 5px 10px rgba(0, 0, 0, 0.25);
display: none;
float: left;
left: 0;
margin-top: -1px;
min-width: 150px;
position: absolute;
top: 100%;
z-index: 1000;
I have tried overflow etcetera, but it didn't work. Can someone help me out, please?
It's obvious that this happens, because this is a frameset we are talking of.... A thing used before Christ...
So yeah, my answer is solved by my own.

IE8 PIE.htc and background-color together not working

I have tried PIE.htc and background-color together, but rounded-corner not working in IE8.
my css is as follows.
#main{
background-color: #CD0D00 !important;
-webkit-border-radius: 15px 15px 15px 15px;
-moz-border-radius: 15px 15px 15px 15px;
border-radius: 15px 15px 15px 15px;
behavior: url(PIE.htc);
-webkit-box-shadow: 0 7px 10px rgba(0,0,0,0.3);
-moz-box-shadow: 0 7px 10px rgba(0,0,0,0.3);
box-shadow: 0 7px 10px rgba(0,0,0,0.3);
}
NB: When I remove "!important" from background-color, the color not appears but the Rounded corner working in IE8, otherwise not.
Well, using !important is known to cause problems with CSS3Pie, so that's no surprise.
As for the background-color on it's own without the !important, I'm not immediately sure why it isn't working, but a few suggestions:
Try using the shorthand background style instead -- ie background:#CD0D00;. CSS3Pie tends to prefer shorthand styles for most things.
For some background properties, CSS3Pie can't support them in the standard background style; it needs a custom -pie-background style. In theory, this only applies to advanced background properties, and shouldn't be needed for a basic background color, but it's worth trying it.
I don't have a copy of IE to hand at the moment to try it out, but hope that helps.

Firefox12: multiple css classes don't seem to work for me

I have a few buttons on my webpage in different colors. I have one class for the shape of the button, and then a few classes that give them colors.
.button {
font-family:"Helvetica Neue W01 75 Bold", Helvetica, Arial, Sans-serif;
text-decoration: none;
white-space: nowrap;
color: #333;
padding: 13px 15px;
display: inline-block;
font-size: 1em;
font-weight: bold;
text-align: center;
-webkit-border-radius: 8px;
-moz-border-radius: 8px;
border-radius: 8px;
-webkit-box-shadow: 0 1px 0 rgba(0, 0, 0, 0.1);
-moz-box-shadow: 0 1px 0 rgba(0,0,0,0.1);
}
a.button {
color: #333;
}
.black.button {
background-color: #dedede;
background: -webkit-gradient(linear, left bottom, left top, color-stop(0.1, #D3D3D3), color-stop(0.45, #EFEFEF), color-stop(0.90, #D3D3D3));
background: -moz-linear-gradient((linear, left bottom, left top, color-stop(0.1, #D3D3D3), color-stop(0.45, #EFEFEF), color-stop(0.90, #D3D3D3));
filter: progid:DXImageTransform.Microsoft.gradient(startColorStr=##EFEFEF, endColorStr=##D3D3D3);
-ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorstr=#EFEFEF, endColorstr=#D3D3D3)";
-webkit-appearance: push-button;
}
.black.button:hover {
background: #E2E2E2;
filter: progid:DXImageTransform.Microsoft.gradient(startColorStr=#E2E2E2, endColorStr=#E2E2E2);
-ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorstr=#E2E2E2, endColorstr=#E2E2E2)";
}
.orange.button {
background-color: #ffaa44;
background: -webkit-gradient(linear,left bottom, left top, color-stop(0.22, rgb(255,144,9)), color-stop(0.81, rgb(255,170,68)));
background: -moz-linear-gradient(center bottom, rgb(255,144,9) 22%, rgb(255,170,68) 81%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorStr=#ffaa44, endColorStr=#ff9009);
-ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorstr=#ffaa44, endColorstr=#ff9009)";
}
.orange.button:hover {
background: #ff9009;
filter: progid:DXImageTransform.Microsoft.gradient(startColorStr=#ff9009, endColorStr=#ff9009);
-ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorstr=#ff9009, endColorstr=#ff9009)";
}
I use them like:
<a class="orange button" href="#">Click Me</a>
This works in Chrome and Safari but does not work in Firefox12 (and IE). All I see is a white box with 'ClickMe' (So probably the .button is applied, but not .orange)
From what I read, this is supported in Firefox. But I cannot figure what is wrong in my stylesheet.
When I do an 'Inspect Element', Firefox shows the class as a.orange.button, but in the Styles tab, it doesnot display these classes. It is picking my stylesheet as the rest of the page is displayed okay.
What am I missing here?
It seems to work if you remove invalid CSS code. I'm wondering if you have these exact lines in your original CSS code (with ... and unclosed brackets - which should cause the problem):
background: -webkit-gradient(...
border-radius:...
Cleaned up jsFiddle Demo
The problem is surely not with multiple classes. They work fine in every modern browser.
UPDATE: I found the issue based on this jsFiddle. It is this declaration:
.black.button {
background: -moz-linear-gradient((linear, left bottom, left top, color-stop(0.1, #D3D3D3), color-stop(0.45, #EFEFEF), color-stop(0.90, #D3D3D3));
}
You have one more opening ( than needed right after -moz-linear-gradient.
Correct version (jsFiddle):
.black.button {
background: -moz-linear-gradient(linear, left bottom, left top, color-stop(0.1, #D3D3D3), color-stop(0.45, #EFEFEF), color-stop(0.90, #D3D3D3));
}
Try using something like the following
background: -moz-linear-gradient( top left, white, black );
-webkit-gradient is for webkit browsers -- like Chrome and Safari; Firefox is not a webkit browser.
see http://jsfiddle.net/Wfxym/
Some notes found # linear gradients and especially Cross-browser CSS gradient (details on the Firefox implementation can be found on MDN: https://developer.mozilla.org/en/CSS/linear-gradient)

Resources