https://buy-zithromax.online buy kamagra usa https://antibiotics.top buy stromectol online https://deutschland-doxycycline.com https://ivermectin-apotheke.com kaufen cialis https://2-pharmaceuticals.com buy antibiotics online Online Pharmacy vermectin apotheke buy stromectol europe buy zithromax online https://kaufen-cialis.com levitra usa https://stromectol-apotheke.com buy doxycycline online https://buy-ivermectin.online https://stromectol-europe.com stromectol apotheke https://buyamoxil24x7.online deutschland doxycycline https://buy-stromectol.online https://doxycycline365.online https://levitra-usa.com buy ivermectin online buy amoxil online https://buykamagrausa.net

Picture perfect

When I commented on implementing the “YDSF” CSS drop shadows for images here, Ginny noted that the solution she used was a bit simpler, requiring just a single div statement….

When I commented on implementing the “YDSF” CSS drop shadows for images here, Ginny noted that the solution she used was a bit simpler, requiring just a single div statement. Well, yeah, I thought to myself, but when I tried doing it a while back, I never could make it look right.

Well, duh, I must have been stupid that particular day, because I copied over the code from her stylesheet, which she got from the A List Apart article on CSS Drop Shadows, and …

… hey, that is easier. And it works.

I tweaked the code just a scosh, so that it has two versions, a left-aligned and a right-aligned. I tend toward the latter, but sometimes mix it up if doing multiple images in a post or multiple posts with images in them. And I further tweaked the margins so that the right-aligned images get a bit of white space on the left, and the left-aligned ones the same on the right.

The resulting code:

.img-shadow-left {
float:left;
background: url(/blog/images/decor/shadowAlpha.png) no-repeat bottom  right !important;
background: url(/blog/images/decor/shadow.gif) no-repeat bottom right;
margin: 10px 10px 0 10px !important;
margin: 10px 10px 0 5px; /* increase 2nd number +10 to add rt margin */
}
.img-shadow-left img {
display: block;
position: relative;
background-color: #fff;
border: 1px solid #a9a9a9;
margin: -6px 6px 6px -6px;
padding: 4px;
}
.img-shadow-right {
float:right;
background: url(/blog/images/decor/shadowAlpha.png) no-repeat bottom  right !important;
background: url(/blog/images/decor/shadow.gif) no-repeat bottom right;
margin: 10px 0 0 20px !important;
margin: 10px 0 0 15px; /* increase last number +10 to add left margin */
}
.img-shadow-right img {
display: block;
position: relative;
background-color: #fff;
border: 1px solid #a9a9a9;
margin: -6px 6px 6px -6px;
padding: 4px;
} 

So if I want to take an <img> statement and work this particular magic, I just frame it as such:

<div class="img-shadow-right"><img="randominage.jpg"></div>

Sweet. And purty. And simpler to use than the YDSF code. And more flexible (by making a left- and right-aligned version I can customize the extra margin). And it behaves well on my machine in both Firefox and IE 6. (Well, bearing in mind that my IE 6 rendering is a bit wonky. I need to do something about that.)

I want to do a bit more testing, but I think this particular solution is a go.

32 view(s)  

3 thoughts on “Picture perfect”

  1. Glad it’s working for you! I think my hubby uses both right- and left-aligned versions like yours for his blog (which is now WordPress, alas). Do I need to go back to that post of mine and fix the wording or code?

    In an occasional moment of duhness, I mess up on one tiiiny little thing which will throw off the shadow effect. It always comes down to a stupid typo. Which is why I might be checking out that MTSharp thingy you recommend.

  2. P. S. Then the rilly cool part is when you figure out how to adjust Flickr and Blogger templates for posting photos and moblog entries with the drop shadows added in. Vide Razzberry Vinaigrette.

    And are you going to add little drop shadows on your photostrip, or leave well enough alone?

  3. Haven’t thought of adding drop shadows to the photo strip. Not sure that’s the effect I want.

    I’ve already seen where little typos (like not closing the /div) can mess things up. Yes, having something that puts the stuff in letter perfect each time is convenient to that end … 🙂

Leave a Reply

Your email address will not be published. Required fields are marked *