I need to make rounded inputs with inner lighting like on this picture:
I can make the rounding like this:
.loginRounded{
-moz-border-radius: 14px;
-webkit-border-radius: 14px;
border-radius: 14px;
outline: 0;
-webkit-appearance: none;
}
But I can't imagine how to make inner lighting with css3.
PS If it's impossible the last way is to use the image as a background.
UPD
Done with box-shadow attribute. But my variant still not the same with psd-layout...
UPD2
Finally done http://jsfiddle.net/Z3SB9/1/ - and the last question - in what browsers it will work correctly?
box-shadow: inset is what you are looking for, take a look at http://jsfiddle.net/Z3SB9/ and play with the values!
Try using a linear gradient, moz example:
background-image: -moz-linear-gradient(top, #eacfaf 0%, #FFF 50%);
fiddle: http://jsfiddle.net/Dnxy2/1/
Related
Is it possible to add a linear gradient and an image to the same element with Compass? Here is the code I am trying but I can't seem to get it to display:
background-color: #ffffff; // Old browsers
#include filter-gradient(#ffffff, #ededed, vertical); // IE6-8
$experimental-support-for-svg: true;
#include background(linear-gradient(top, #ffffff 0%,#ededed 100%), image-url('../img/questionmark.png' top, left, no-repeat));
padding: 10px;
font-size: 14px;
border-bottom: solid 1px #d3d3d3;
It's possible - instead of non-existing image-url use url. In your example gradient will cover the image (what comes first in the declaration in closer to top).
The example pen with gradient and image.
Edit
The answer, while solving the problem, was misleading.
The image-url function
Contrary to what I wrote before it does exist. It returns url to the image relative to compass images folder.
I have this Jquery slider plugin for Wordpress, and it's just the jquery cycle plugin by Malsup.
Anyway, I added a caption in each slide. I just can't find a color that shows clearly in each slide. So I made a semi-transparent (50% opacity) png in Photoshop, 5px x 5 px. Currently, my CSS looks like this:
.homepage-slides p {
background: transparent url('images/title-bg.png') repeat top left;
bottom: 0;
left: 0;
color: #000000;
font-size: 12px;
font-weight: bold;
margin: 0;
padding: 5px;
position: absolute;
text-align: left;
width: 100%;
}
I also tried using an absolute path to the png, but no go. Here's the result:
As you can see, the caption in the bottom is almost impossible to read. It'd be cool if I could find a way to have like ... this semi-transparent, yellow rectangular box and then have the black caption inside that box, so you could read the caption. Any help with this would be truly appreciated!
Mr.Jason
Try this Html and Css,
<body>
<div class="stroke-effect">
This text should have a stroke in some browsers
</div>
</body>
Css
body{
background-color:#000;
}
.stroke-effect{
font-weight:bold;
color: #000;
text-shadow:
-1px -1px 0 #ffffff,
1px -1px 0 #ffffff,
-1px 1px 0 #ffffff,
1px 1px 0 #ffffff;
}
Check this http://jsfiddle.net/VqDKp/
Good Luck!
I'd recommend not using images. One reason is that png images with transparent backgrounds don't have transparency in some browsers (I know it maybe only older browsers but still).
Another reason. The image wont be positioned 100% of the background in your script.
I personally like using CSS made backgrounds as they pretty much cover all browsers types. Here's my background example for you :)
background:rgba(200,200,200,0.5); //50% silver-ish background.
You could use an opacity. But I wouldn't recommend that as it would effect the content in your p element as well as. I believe using an alpha filter would do the same but it's been a while since I've used them.
Here's a further example for you :)
background:linear-gradient(top, rgba(0,0,0,0) 0%, rgba(70,70,70,0.5) 30%, rgba(200,200,200,0.5) 100%);
//from top to bottom 100% transparent black.
//Very dark grey 50% transparent at 30% from the top of the element.
//Silver-ish 100% at the bottom at 50% transparency.
using the webkit extensions respectively for the above example :)
I hope this helps.
I have the following submit button in IE9:
The CSS I'm using is as follows:
.button,
input[type='button'],
input[type='submit'] {
text-decoration: none;
background: #eee;
color: #89a9d1;
padding: 4px 10px;
font-weight: bold;
-ms-filter: "progid:DXImageTransform.Microsoft.gradient(GradientType=0,startColorstr='#fff', endColorstr='#eee')";
background: -webkit-gradient(linear, left top, left bottom, from(#fff), to(#eee));
background: -moz-linear-gradient(top, #fff, #eee);
}
From what I understand on this page: http://www.colorzilla.com/gradient-editor/ this should work... I can't figure out where the blue is coming from. Using the IE developer toolbar if I deselect all styles that affect this element it still shows up looking like the image I've attached.
Does anyone have any suggestions on what could be causing this?
ColorZilla does not generate gradients with three-digit hexadecimal color values as they are interpreted differently within IE's filters (in fact, I believe they're invalid color strings). This discrepancy in your code is what's causing your gradient to appear blue in IE.
You need to expand the hex colors to six digits for them to be interpreted correctly:
-ms-filter: "progid:DXImageTransform.Microsoft.gradient(GradientType=0,startColorstr='#ffffff', endColorstr='#eeeeee')";
I am trying to get a transparent PNG & Gradient to display at the same in IE. Right now, the filter dominates over the background image. If I take out the filter, the PNG does display. Ideally, I would like the PNG to be on top of the gradient.
CSS:
.defaultSelection {
border: 1px solid #bbb; color: #222222; outline: 0 none;
background: url('/img/dropdown-arrow.png') right center no-repeat;
filter: progid:DXImageTransform.Microsoft.gradient(GradientType=0, startColorstr='#e9e9e9', endColorstr='#ffffff' )
}
HTML:
<li class="defaultSelection">Current Selection</li>
Good news: This is possible with IE (despite what others have said). But it does need a little hack called CSS3Pie.
CSS3Pie is a hack for IE which allows it to support a variety of CSS3 features using ordinary CSS, rather than those horrible filter styles.
See here for its supported features: http://css3pie.com/documentation/supported-css3-features/
You'll note that this includes the ability to specify a background with an image and a gradient:
As described on the page linked above, simply specify your CSS with -pie-background in addition to the normal background style, and also with the Pie behavior style to run the Pie script.
#myElement {
background: url(bg-image.png) no-repeat #CCC; /*non-CSS3 browsers will use this*/
background: url(bg-image.png) no-repeat, -moz-linear-gradient(#CCC, #EEE); /*gecko*/
background: url(bg-image.png) no-repeat, -webkit-gradient(linear, 0 0, 0 100%, from(#CCC) to(#EEE)); /*webkit*/
background: url(bg-image.png) no-repeat, linear-gradient(#CCC, #EEE); /*future CSS3 browsers*/
-pie-background: url(bg-image.png) no-repeat, linear-gradient(#CCC, #EEE); /*PIE*/
behavior: url(PIE.htc);
}
Behind the scenes, CSS3Pie creates a VML element, and layers it with the real element to achieve the desired effects (VML is a vector graphics language which is supported by IE6 and up). But you don't need to know any of this, as Pie goes to some lengths to make itself completely transparent to the developer and to the user. It does have some bugs and known issues, but overall it's a very very good tool for pulling older versions of IE up to some sort of parity with more modern browsers.
Have you tried using the gradient on the li and then applying the image on an element within the li?
<li class="defaultSelection">Current Selection<span class='bg'> </span></li>
.defaultSelection {
border: 1px solid #bbb; color: #222222; outline: 0 none;
filter: progid:DXImageTransform.Microsoft.gradient(GradientType=0, startColorstr='#e9e9e9', endColorstr='#ffffff' )
}
.defaultSelection .bg{
display:inline-block;
width: 10px;
height:10px;
background: transparent url('/img/dropdown-arrow.png') right center no-repeat;
}
This is not possible with IE as a filter gradient is essentially another background image (it takes its place.) Try reversing the order to have the filter first and the bg image last in the CSS selector, you'll most likely see the image.
Your best bet is to go with layering, or make on PNG that has both the image and transparency.
After my 1st question with relation to CSS3 gradients in which I was recreating an 'inner glow' I've now got to the point where I'm not so happy with the way in which webkit renders the effect.
Basically, if you give an element a background colour and apply a border radius to it, webkit lets the background colour "bleed" out to fill the surrounding box (making it look a bit awful)
To reproduce the undesirable effect, try something like the following
section#featured footer p a
{
color: rgb(255,255,255);
text-shadow: 1px 1px 1px rgba(0,0,0,0.6);
text-decoration: none;
padding: 5px 10px;
border-radius: 15px;
-moz-border-radius: 15px;
-webkit-border-radius: 15px;
background: rgb(98,99,100);
-moz-box-shadow: inset 0 0 8px rgba(0,0,0, 0.25);
-webkit-box-shadow: inset 0 0 8px rgba(0,0,0, 0.25);
}
Apparently this appears to be a Windows-only problem, so for those on a Mac, here's a screenshot: (Check the 'carry on reading' button)
(source: friendlygp.com)
You'll notice that in Safari/Chrome (the latest available public downloads as well as the latest nightlies as far as I can tell), you get a rather ugly background colour bleed. However, in Firefox, you should be able to see what I'm after. If you're in Internet Explorer, woe betide you.
Does anyone know of a technique which will allow me to produce the 'correct' effect? Is there a CSS Property which I've missed that tells webkit to only have the background within the border-radius'd part of the containing box.
I could potentially use an image, but I'm really trying to avoid it. Naturally, as we're dealing with CSS3 and the landscape is continually changing, I might just have to 'lump' it and revert to an image.
However, if anyone can suggest an alternative I would be very much appreciative!
Finally, after an awfully long time, someone much cleverer than I has a solution to this:
-moz-background-clip: padding; /* Firefox 3.6 */
-webkit-background-clip: padding; /* Safari 4? Chrome 6? */
background-clip: padding-box; /* Firefox 4, Safari 5, Opera 10, IE 9 */
is your friend :)
From: http://tumble.sneak.co.nz/post/928998513/fixing-the-background-bleed
This is, unfortunately, a known bug. You can sorta work around it by giving your element a background-coloured border big enough to cover the leaking inset shadow, but it's far from an ideal solution.