Skip to main content

CSS Shadows

What up?

I have a couple of CSS gems I wanted to share with you. This first one is called a top shadow. Here is the effect:

Compare this version to the not so fun version:


Here is the code for that little effect:


Another little gem is putting a drop shadow under images. Here is a screenshot within eCollege with two images, one has a drop shadow:

If you like that shadow as it is, then use this code:


Okay, now stay with me. That code should put a drop shadow on all images on the page (if you have multiple images). The code is essentially saying that whereever there is an <img>, then the browser is to apply those settings. You can also put drop shadows on <div>s if you would like. Just change the

img { … }

so that it reads


If you want some pictures to have shadows and not others, then create a class. In the above example I had the two pictures and for the sake of illustrating the drop shadow, I wanted one to have the shadow and the other to not have the shadow. Below is the code that I used for the above images. Notice the elements include a blurb of CSS at the top, then an image, and finally another image with a defined class:


Notice how in the internal CSS I defined the class [.shadow { … }] and in the second image I specified the class [<img> class="shadow"]. If you want to create your own shadows, adjusting the properties like the color, depth, spread of the shadow, then check out this website http://css3please.com/.

You can also tweak the shadow yourself if you want. Just change the values

-moz-box-shadow: 3px 3px 4px #000;
-webkit-box-shadow: 3px 3px 4px #000;
box-shadow: 3px 3px 4px #000;

to whatever values you want. You have 4 values: the x-axis, the y-axis, the spread or blur, and the color. Feel free to tinker with the javascript for IE, but I wouldn't worry. This effect is essentially not important enough to dedicate the time to making it compatible for IE. IE9 is overdue, but it is going to be compliant with the CSS3 standards.

If you are interested in a text shadow, give this a try:


And then when you put in text, specify <p class="text-shadow">. You can change the color from #999 to whatever you want, and the 1px 1px 3px is like saying how far to the right of the text should the shadow fall, how far below the text should the shadow fall, and then what is the spread (blurriness of the shadow). Those values will all depend on the size, font, color of the text you are using or the background of your page (if you have a background).

Comments

Popular posts from this blog

Encouraging student voice and video comments

Hey team, Won and I are at the Sloan-C Emerging Technology conference (#et4online), and I wanted to share some ideas with you all regarding the utilization of audio and video features in our discussion boards.  The presenter who inspired this post is Michelle Pacansky-Brock who wrote an ebook about VoiceThread. Her institution bought a site license so that students could make comments on VT via phone, ensuring that technology wouldn't be a barrier to student participation. My thoughts are that our online and most blended students have both computers with webcams/microphones and smartphones. I think that in Canvas we don't need to rely so much on VT to facilitate an audio/visual discussion, as these features are integrated into the learning platform. Michelle conducted research in her classes via surveys and discovered that when she as an instructor left voice and video comments, 97% of the students appreciated such comments. However, 75% of the students were unwilling ...

What's all this talk about APIs?

These application programming interfaces (APIs) are all the rage these days.  We hear about them in online commerce, social media, and now they are flooding the world of education and online learning.  So what are they exactly? An API is a way for websites, programmers, and applications to communicate with each other, exchanging information.  If I have a database with information that I would like to disseminate then I can develop an API and make that accessible to the world.  External developers can then create APIs with the purpose of communicating with my  API, and thus extract the information that I am making public.  It's similar to the notion of "my people will contact your people and we'll make this happen".  Only the people in mention is actually a software-to-software exchange. Why APIs are important APIs are a way to access information or databases which would otherwise be inaccessible.  For example, my database might be protected ...

Recap of L&L

I just wanted to put up a recap of what I went over yesterday. This should be useful for Nicole and Gia, who didn't make it for that portion, as well as for anyone who would like to go over that again. The short description of my portion yesterday was that there are a wealth of resources and materials built right into PowerPoint that most people don't know about (or they don't realize the possibilities available). We are able to take what is given to us and modify it and truly make it our own.