Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CSS glassy slightly folded borders 3D effect

Tags:

css

I am trying to get the similar kind of look ( see the below image) using CSS . This has all the borders are slightly folded and has lite 3D look . I tried using box-shadow and pasted the code below . This gives me some what similar kind of shape but can not get fine one and also using two DIVs to get that effect . Can we get using a single DIV ..? Thank You

enter image description here

.div-1 {
  width:150px;
  height:300px;
  box-shadow: 0 3px 6px rgba(0,0,0,0.16), 0 3px 6px rgba(0,0,0,0.23);
  border-radius: 10px;
 }

.div-2 {
  width:100%;
  height:100%;
  box-shadow: width:100%;height:100%;box-shadow: 0 0 5px #aaa inset;
  border-radius: 10px;
}
<!DOCTYPE html>
<html>
<body>
  <div class="div-1">
    <div class="div-2"></div>
  </div>
</body>
</html>
like image 828
Bujji Avatar asked Apr 04 '18 14:04

Bujji


People also ask

How do you make a 3D border in CSS?

We can assign a 3D groove border to an element using the following syntax. Syntax: border-style: groove; Approach: In this example, we will give the grooved border to the heading h1.

What border style defines a 3D outset border?

ridge - Defines a 3D ridged border. The effect depends on the border-color value. inset - Defines a 3D inset border. The effect depends on the border-color value. outset - Defines a 3D outset border.

What is border padding?

Introduction to CSS Border Padding. Padding is defined as space between the HTML contents and its borders. In general, padding will create some extra spaces within the HTML elements we can mention the padding in pixels, percentage format values in the document.


1 Answers

I think you can go like this :

.div-1 {
  width:150px;
  height:300px;
  box-shadow: inset 0 3px 6px rgba(0,0,0,0.16), 0 4px 6px rgba(0,0,0,0.45);
  border-radius: 10px;
 }
<!DOCTYPE html>
<html>
<body>
  <div class="div-1">
  </div>
</body>
</html>
like image 124
Sandwell Avatar answered Sep 30 '22 04:09

Sandwell