Question

I dont kmow how to explain this, if this is a design question please correct me. Look at the following facebook header.enter image description here

That friend requests icon and sort look like they are inside the background, how do i do this with css?

Was it helpful?

Solution 2

You can accomplish the sort button styling, by using box-shadow - and inset to get the shadow inside the button. As well as border-radius for rounding the corners.

HTML

<a href="#" class="button">button</a>

CSS

body { background:#4b669d; padding:40px; 
       font-family: Arial, "Helvetica Neue", Helvetica, sans-serif;}

a { 
    display:inline-block; 
    font-size:12px;
    padding:0 20px;
    margin:10px;
    height:30px; 
    background:#435c91; 
    border:1px solid #2a3349; 
    text-align:center;
    color:#fff;
    line-height:26px;
    text-decoration:none;

     border-radius:5px;

/* this is the inner shadow and drop shadow */    
-webkit-box-shadow:inset 0 0 3px 2px rgba(0,0,0,0.15), 1px 1px 0px 1px rgba(255,255,255,0.3);
box-shadow:inset 0 0 3px 2px rgba(0,0,0,0.15), 1px 1px 1px 0px rgba(255,255,255,0.3);

/* gradient - from http://www.colorzilla.com/gradient-editor/ */
background: rgb(93,114,163); /* Old browsers */
background: -moz-linear-gradient(top, rgba(93,114,163,1) 0%, rgba(46,72,128,1) 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(93,114,163,1)), color-stop(100%,rgba(46,72,128,1))); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, rgba(93,114,163,1) 0%,rgba(46,72,128,1) 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, rgba(93,114,163,1) 0%,rgba(46,72,128,1) 100%); /* Opera 11.10+ */
background: -ms-linear-gradient(top, rgba(93,114,163,1) 0%,rgba(46,72,128,1) 100%); /* IE10+ */
background: linear-gradient(to bottom, rgba(93,114,163,1) 0%,rgba(46,72,128,1) 100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#5d72a3', endColorstr='#2e4880',GradientType=0 ); /* IE6-9 */
}

Obviously it requires a bit more tweaking, but hopefully that should be a starting point.

JSFiddle Demo 2 - now with gradient background and a drop-shadow too.

and http://jsfiddle.net/53fWz/6/

OTHER TIPS

You could do something like this (Just whipped it up, so it's not perfect).

I used colours from the Facebook image you provided.

Here is what I did:

HTML:

<div id="container">
    <div id="inset"></div>
</div>

CSS:

#container{
    height:200px;
    width:200px;
    background:#48639b;
}

#inset{
    background:#31497e;
    height:50px;
    width:50px;
    box-shadow:inset 0px 0px 5px #1f2f50;
}

JSFiddle -- Try one

JSFiddle -- Try two

The JSFiddle as a few extra styles to put #inset more into the container, but they don't affect the over style of the inset.

Use multiple box-shadows to give the embossed effect.

box-shadow:inset 0 1px 1px rgba(0,0,0,0.7), 0 1px 0 rgba(255,255,255,0.3);

http://jsfiddle.net/Em97N/2/

You should color the image, with a more dark color than the forground. Simple design. Maybe add a black border arround it.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top