General Discussion

How to Create a Box with Shadow Using CSS?

Viewing 1 post (of 1 total)
  • Author
    Posts
  • #6699
    Ankit
    Participant

    To create a box with shadow using CSS, apply the box-shadow property to a <div> element. First, define its width, padding, background color, and other basic styles. Then add shadow values to control its appearance.

    For example:
    .box {
    width: 250px;
    padding: 20px;
    background: white;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    }

    The first two values control the shadow’s horizontal and vertical positions, while the third controls blur intensity. You can adjust these values to create subtle or stronger effects for website cards, buttons, and content sections.

Viewing 1 post (of 1 total)
  • You must be logged in to reply to this topic.