Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to achieve this css3 shadow effect? [closed]

Tags:

css

shadow

I am trying to see if its possible to achieve this kind of shadow using pure css3:

enter image description here

I quickly mocked this up in photoshop. I am looking for that curved shadow effect. I know its possible to get straigt shadow effects. I tried to look on google I dont even know what to call that curved shadow. I couldn't find anywhere that says its not possible. Couldnt find anywhere that says it IS possible either.

if css3 isn't happening, I am willing to use jQuery.

any help, much appreciated. thanks.

edit: The closest I've gotten to achieve any sort of shadow just with css3 is this: http://jsfiddle.net/tVt4w/

like image 744
LocustHorde Avatar asked May 31 '11 16:05

LocustHorde


People also ask

How do you add shadow to elements in CSS3?

In CSS, shadows on the boxes of elements are created using the box-shadow property (if you want to add a shadow to the text itself, you need text-shadow ). The box-shadow property takes a number of values: The offset on the x-axis. The offset on the y-axis.

What does the CSS3 attribute box shadow effect?

The box-shadow property enables you to cast a drop shadow from the frame of almost any element. If a border-radius is specified on the element with a box shadow, the box shadow takes on the same rounded corners.

Which CSS3 property can you use to apply a shadow effect to text?

The text-shadow CSS property adds shadows to text. It accepts a comma-separated list of shadows to be applied to the text and any of its decorations .


2 Answers

At first I didn't think it was possible. Then I found this page that shows some nice examples in pure css.

Nifty.

See the demo page for an idea of what can be achieved.

like image 166
stefgosselin Avatar answered Oct 20 '22 02:10

stefgosselin


HTML and CSS only

The shadow automatically adapts to the width of the image.

Using a PNG image, this can be done:

(not exhaustively tested for compatibility but it works in the latest FF, Safari and Chrome)

<style type="text/css" media="all">
.shadow {
    position:relative;
    width:auto;
    padding:0;
    margin:0;
}
.shadow:before,
.shadow:after {
    content:"";
    position:absolute; 
    z-index:-1;
}
.arch01:after {
    position:absolute;
    padding:0; margin:0;
    height:34px;
    width:100%;
    bottom:-30px;
    left:0px; right:0px;
    background-image: url('arch_01.png');
    background-size:100% 100%;
    background-position:left top;
}
</style>


<span class="shadow arch01">
    <img src="photo.jpg" width="500px" height="250px">
</span>
like image 20
unidentified-1 Avatar answered Oct 20 '22 01:10

unidentified-1