IMPORTANT

FM Design is in read-only mode, please click here for more information.

Latest topics
» Forumactif Edge - Releases
by Ange Tuteur Tue 09 Oct 2018, 11:34

» Forum Closure
by Ange Tuteur Mon 01 Jan 2018, 01:28

» Chit Chat Thread
by Valoish Sun 31 Dec 2017, 19:15

» Font/Text background color.
by Valoish Sun 31 Dec 2017, 19:11

» Forumactif Messenger - Instant Message Application for Forumotion
by Wolfuryo Sun 31 Dec 2017, 18:24

» [GAME] Count to One Million!
by brandon_g Fri 29 Dec 2017, 18:58

» Post Cards
by manikbiradar Wed 20 Dec 2017, 07:50

» [GAME] Countdown from 200,000
by Valoish Wed 13 Dec 2017, 23:22

» GeekPolice Tech Support Forums - GeekPolice.net
by Dr Jay Mon 11 Dec 2017, 19:12

» Asking about some plugin for Forumotion
by Dr Jay Mon 11 Dec 2017, 19:10

» [GAME] What are you thinking right now?
by Van-Helsing Sat 09 Dec 2017, 14:51

» Widget : Similar topics
by ranbac Wed 06 Dec 2017, 18:11

» Change the Background of the Forum and put an image and how to make prefixs?
by Clement Wed 06 Dec 2017, 15:19

» Hello from Western Australia
by SarkZKalie Wed 06 Dec 2017, 05:34

» Numbering of messages in the topic
by SLGray Mon 04 Dec 2017, 22:40

Recent Tutorials
Top posting users this month

Who is online?
In total there are 3 users online :: 0 Registered, 0 Hidden and 3 Guests :: 1 Bot

None

[ View the whole list ]


Most users ever online was 172 on Fri 19 Feb 2016, 05:17

box-shadow glossy effects and more

View previous topic View next topic Go down

avatar
Ange Tuteur
Administrator
Gender : Male
Age : 23
Posts : 4736
Points : 10024
Reputation : 2369
Location : Macungie, PA
Language : EN, JA, FR
Browser : Browser : Brave Forum Version : Forum Version : Forumactif Edge
View user profile https://github.com/SethClydesdale https://twitter.com/sethc1995

PostAnge Tuteur on Fri 11 Oct 2013, 01:17

Hello Guest, I will explain how you can achieve a glossy effect with CSS using background-color and box-shadow.

Below is a blue square with text in it, our background color is set as #245A75, or:
Code:
div{background-color:#245A75;}
<center><div style="width:100px;height:100px;background-color:#245A75;color:#fff;"><br /><br />Hello, I'm a square!</div></center>

To achieve a glossy effect we make use of box-shadow, and set it to inset so our shadow will be inside the box rather outside it. To achieve the effect in the square below, you should always use colors lighter than your background color so it will appear to have a shine.
Code:
div{
background-color:#245A75;
box-shadow:0px 12px 6px #447A95 inset;
}
<center><div style="width:100px;height:100px;background-color:#245A75;box-shadow:0px 12px 6px #447A95 inset;color:#fff;"><br /><br />Hello, I'm a glossy square!</div></center>

What's great about box-shadow is that you can chain together multiple shadows in one property by using a comma! So you can have a glossy effect on top, a shadowy effect on the bottom, and a shadow on the outside of the box.
Code:
div{
background-color:#245A75;
box-shadow:0px 12px 6px #447A95 inset, 0px -10px 6px #144A65 inset, 3px 5px 6px rgba(0,0,0, 0.5);
}
<center><div style="width:100px;height:100px;background-color:#245A75;box-shadow:0px 12px 6px #447A95 inset, 0px -10px 6px #144A65 inset, 3px 5px 6px rgba(0,0,0, 0.5);color:#fff;"><br />Hello, I'm a square with three shadows!</div></center>

For the last shadow on the box above we used rgba, it is the same as rgb, but with an alpha filter to add opacity to our colors. This helps maintaining our colors a lot easier, especially for drop shadows.

Inset shadows are especially useful for rounded elements, in the example below you can see how different the shadows look compared to a linear object. You can round the corners using the border-radius property, to make an element a complete circle you will have to use a value that is half, or equal to that of the elements height/width.
Code:
div{
border-radius:50px;
background-color:#245A75;
box-shadow:0px 12px 6px #447A95 inset, 0px -10px 6px #144A65 inset, 3px 5px 6px rgba(0,0,0, 0.5);
}
<center><div style="width:100px;height:100px;background-color:#245A75;box-shadow:0px 12px 6px #447A95 inset, 0px -10px 6px #144A65 inset, 3px 5px 6px rgba(0,0,0, 0.5);color:#fff;border-radius:50px;"><br /><br />I'm a circle now!</div></center>

If you have any questions, or want to share some ways you like to use box shadow feel free to leave them below. Thanks for reading!

--------

Ange Tuteur
Tips and TricksContact Me

View previous topic View next topic Back to top

Create an account or log in to leave a reply

You need to be a member in order to leave a reply.

Create an account

Join our community by creating a new account. It's easy!


Create a new account

Log in

Already have an account? No problem, log in here.


Log in

 
Permissions in this forum:
You cannot reply to topics in this forum