CSS arrow to the right of a rounded rectangle "next" button - css

I want very simple markup (<a class="next">Next</a>) to show a button with rounded corners, but with an arrow pointing right (like the "back" navigation button at the top of some iPhone apps). This is what I have so far (jsfiddle link here):
a.next {
padding: 6px 12px;
border-width: 1px !important;
border-color: #333 !important;
background: #5BFF2D; /* for non-css3 browsers */
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#5BFF2D', endColorstr='#20CA00'); /* for IE */
background: -webkit-gradient(linear, left top, left bottom, from(#5BFF2D), to(#20CA00)); /* for webkit browsers */
background: -moz-linear-gradient(top, #5BFF2D, #20CA00); /* for firefox 3.6+ */
border-radius: 6px 0 0 6px !important;
border-style: solid none solid solid !important;
}
a.next:after {
content: '';
display: block;
width: 0px;
height: 0px;
border-top: 12px solid transparent;
border-left: 16px solid green;
border-bottom: 12px solid transparent;
background: white;
}​
..which looks like this:
As you can see, it doesn't work at all. My thoughts at this point are: even if I do get the arrow correctly positioned, it'll never show the background gradient, much less the 1px border, correctly.
Is there a clean way of doing this?

Original Answer
This gets very close, but without a border. If you want to add a span inside, then the border becomes possible also, as well as some smoothing on the 'faked' gradient.
Updated Answer
This achieves the gradient and overall looks better. The main issue is that it requires you to have a solid background color behind it (white, in this case).
Final Answer
This actually does support the gradient leaving the angles transparent. It only will work in browsers supporting CSS3 transforms. I tested in IE9, FF 11, Chrome 18. IE9 is not showing your filter gradient. Chrome renders on my screen with a snubbed point to the arrow (perhaps with some browser targeting, variations like that could be adjusted for).

Related

Background-color shows through an SVG icon with the exact same size

At first let me aknowledge you to this issue. I had an anchor with these properties:
.upvote_box a {
width: 20px;
height: 21px;
display:block;
background-color: #828282;
background-image: url(../imgs/upvote.svg);
background-size: 20px 21px;
}
The background-color there has a meaning, because it transits into a different color through CSS3 transitions. So my SVG is a white box with a cut hand icon in it. The rendering on Chrome on desktop was fine. But then I checked Safari and I saw these tiny lines around this anchor. So then I made an SVG icon with 1px border in it. So the dimensions of the SVG after that were width: 22px; height:23px;Of course I changed all the setting in the CSS, too. But I also added one thing to prevent this from happening – box-shadow: inset 0px 0px 0px 1px #fff – this solved the problem in Safari on desktop. But the problem sustains on mobile Chrome and mobile Safari.
This is what it looks like:
Also there is link to JSFiddle: Fiddle
Thank you!
add this :
-webkit-appearance: none;
or this :
-webkit-box-shadow: inset 0px 0px 0px 1px #fff

Unable to set the width of webkit-scrollbar-thumb

I am trying to style up a custom scrollbar that works in Chrome and Safari. I’ve tried the following CSS:
::-webkit-scrollbar {
width: 15px;
}
::-webkit-scrollbar-track {
background-color: rgba(100, 100, 100, .5);
width: 15px;
}
::-webkit-scrollbar-thumb {
background-color: #818B99;
border-radius: 9px;
width: 9px;
}
However the width on the -webkit-scrollbar-thumb is being ignored. I would like the thumb to be thinner than the track, as above.
It appears that I can fake the width by setting a border on the -webkit-scrollbar-thumb of 3px with the same colour as the track, however this only works with an opaque background colour, and I need it to work with a transparent colour for the track as above.
Example jsfiddle: http://jsfiddle.net/L6Uzu/1/
You are correct that WebKit ignores the width declaration on the scrollbar-thumb. It also ignores it on the track.
The problem with using a border is that it draws the border within the thumb, so if you just make the colour transparent, it will not work.
The solution is to change where the background is attached. By default the background extends under the border, as mentioned. You can use the background-clip property to change this, so that it only extends to the edge of the padding box instead. Then you just need to make a 3px transparent border, then Bob’s your uncle:
::-webkit-scrollbar-thumb {
background-color: #818B99;
border: 3px solid transparent;
border-radius: 9px;
background-clip: content-box;
}
See http://jsfiddle.net/L6Uzu/3/
This works correctly in Chrome, but Safari doesn’t have as advanced a border-radius implementation, so the rounded corners are not visible.

Black color appearing over the button when user clicks on the button

i am using enyo buttons in iphone....the problem is , when i click on button for a navigation , black color appears over the button....i dont know whether it is shadow or border-color or background-color.... i want to remove this...plz help me....
my code goes here
.onyx-Button2 {
outline: 0;
color: #FFFFFF;
font-size: 16px;
text-align: center;
white-space: nowrap;
margin: 0;
padding: 1px 1px;
overflow: hidden;
border-radius: 3px;
/* for IE8 */
border: 1px solid #777;
border: 1px solid rgba(15, 15, 15, 0.2);
/*
The border and the gradient interact in a strange way that
causes the bottom-border (top if the gradient is aligned top)
to be lighter than other borders.
We can fix it by using the darker bottom border below, but
then there are a few rogue pixels that end up very dark.
*/
box-shadow: inset 0px 1px 0px rgba(255,255,255,0.2);
background: #E1E1E1 url(../../images/gradient.png) repeat-x bottom;
background-size: contain;
text-overflow: ellipsis;
}
It is possibly down to defaults set within the browser on iOS - I would set all the appropriate properties to cover all bases.
So add
background-color:#ffffff; // Change this to your color you want
I suspect it is just the way iOS defaults some CSS, it may also have something to do with the manner in which it deals with image's as backgrounds. Unfortunately while iOS goes with most standards, it has odd ways of implementing certain CSS.

CSS hover issues only in opera

I have the site
and it renders ok, even in IE. However in Opera 11.62 there is a very weird bug whenever I am hovering over the links from the navbar. Why does this happen? It is very annoying.
There is also a very weird thing that is happening, if I resize the browser window so the last link is out the pages than only the last link it displays ok on hover, but the other 2 are still broken.
Add this line of code to a:hover
height: 100%;
So you get:
a:hover {
background: -o-linear-gradient(top, #93C9ED 0px, #76B4E1 100%) transparent;
border-bottom: medium none currentColor;
border-left: 1px solid #1C5E9C;
border-right: 1px solid #1C5E9C;
border-top: 1px solid #1C5E9C;
color: #275D8B;
height: 100%;
}
Add a height to the anchor tag, same as your line-height:
header nav ul li a { height:2.5em; }
This works for me, in Opera 11.64. I see you've already tried this solution, but I'm guessing the reason you haven't made it work, is because the line-height is 2.5em, not 2.8 (unless you've changed it).

CSS3 button renders differently on web vs iOS

I found some code for generating CSS3 buttons which I'm using on my site. The buttons look great when viewed in the browser. However, on the mobile web version of my site (which uses the same styles) the buttons render differently. Even stranger, if I use Safari and view my site with User Agent of iPhone the buttons look as they should. However in iOS Simulator they don't. Can someone help me understand why?
Here's the code I'm using:
.button, #button .button, li.button .button {
display: inline-block;
zoom: 1;
*display: inline;
vertical-align: baseline;
outline: none;
cursor: pointer;
text-align: center;
text-decoration: none;
font: 14px/100% Arial, Helvetica, sans-serif;
padding: .5em 1.5em .55em;
text-shadow: 0 1px 1px rgba(0,0,0,.3);
-webkit-border-radius: .5em;
-moz-border-radius: .5em;
border-radius: .5em;
-webkit-box-shadow: 0 1px 2px rgba(0,0,0,.2);
-moz-box-shadow: 0 1px 2px rgba(0,0,0,.2);
box-shadow: 0 1px 2px rgba(0,0,0,.2);
}
.orange, #button .orange {
color: #fef4e9;
border: solid 1px #da7c0c;
background: #f78d1d;
background: -webkit-gradient(linear, left, top, left bottom, from(#faa51a), to(#f47a20));
background: -moz-linear-gradient(top, #faa51a, #f47a20);
filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#faa51a', endColorstr='#f47a20');
}
Here is how it renders in the browser:
And here is how it renders on an iPhone:
Apply "-webkit-appearance:none;" on your css properties and add this line
"input[type=submit], input[type=Reset]{ -webkit-appearance:none; }".
As Shakti says you should just put the following css for the button.
-webkit-appearance: none;
This is explained further in this question:
'CSS submit button weird rendering on iPad/iPhone'
It seems that on iOS the buttons have the default iOS rounded look if you supply just a simple background color :
background: orange
But if you supply a gradient then this is effectively overriding the appearance css property to use a custom style.
But because you had the wrong syntax it was giving you the iOS look.
I caught my mistake. I had the wrong syntax for -webkit-gradient. Instead of:
-webkit-gradient(linear, left, top, left bottom, from(#faa51a), to(#f47a20));
It's...
-webkit-gradient(linear, left top, left bottom, from(#faa51a), to(#f47a20));
I had a comma between left and top where it shouldn't have been.
Have you tried using an SVG as your background image (generator can be found here)? Using this worked on an iPhone 3G I have lying around (jsFiddle link here):
background-image:url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxMDAlIiBoZWlnaHQ9IjEwMCUiIHZpZXdCb3g9IjAgMCAxIDEiIHByZXNlcnZlQXNwZWN0UmF0aW89Im5vbmUiPgo8bGluZWFyR3JhZGllbnQgaWQ9Imc5MDQiIGdyYWRpZW50VW5pdHM9InVzZXJTcGFjZU9uVXNlIiB4MT0iMCUiIHkxPSIwJSIgeDI9IjEwMCUiIHkyPSIxMDAlIj4KPHN0b3Agc3RvcC1jb2xvcj0iI0ZBQTUxQSIgb2Zmc2V0PSIwIi8+PHN0b3Agc3RvcC1jb2xvcj0iI0Y0N0EyMCIgb2Zmc2V0PSIxIi8+CjwvbGluZWFyR3JhZGllbnQ+CjxyZWN0IHg9IjAiIHk9IjAiIHdpZHRoPSIxIiBoZWlnaHQ9IjEiIGZpbGw9InVybCgjZzkwNCkiIC8+Cjwvc3ZnPg==);
This is compatible with IE9, Chrome, Safari and Opera. This will not work with IE7/8. What I suggest is using an IE specific stylesheet or adding to the .orange class instructions to apply the style to IE7 or IE8 and below. More info on that here.

Resources