Home > AI > Language > CSS >

box-shadow

Example 1:

div {
  box-shadow: 10px 10px;
}

Example 2:

div {
  box-shadow: 10px 10px grey;
}

Example 3:

div {
  box-shadow: 10px 10px 5px grey;
}

Example 4: Image Card

<!DOCTYPE html>
<html>
<head>
<style>
div.polaroid {
  width: 250px;
  box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);
  text-align: center;
}

div.container {
  padding: 10px;
}
</style>
</head>
<body>

<h2>Polaroid Images / Cards</h2>

<p>The box-shadow property can be used to create paper-like cards:</p>

<div class="polaroid">
  <img src="rock600x400.jpg" alt="Norway" style="width:100%">
  <div class="container">
    <p>Hardanger, Norway</p>
  </div>
</div>

</body>
</html>

Tool: box-shadow generator

You can use this tool to quickly get desired effect

https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Background_and_Borders/Box-shadow_generator

Leave a Reply