What are the possible values for the horizontal and vertical position of the shadow?

QuestionsQuestions8 SkillsProCSS Box Model and MarginsSep, 12 2025
0134

In CSS, the horizontal and vertical position of a shadow can be defined using the box-shadow property. The possible values for the horizontal and vertical offsets are typically specified in pixels (px), ems (em), or percentages (%). Here’s a breakdown:

Syntax

box-shadow: horizontal-offset vertical-offset blur-radius spread-radius color;

Values

  1. Horizontal Offset:

    • Positive values move the shadow to the right.
    • Negative values move the shadow to the left.
  2. Vertical Offset:

    • Positive values move the shadow down.
    • Negative values move the shadow up.

Example

box-shadow: 10px 5px 15px rgba(0, 0, 0, 0.5); /* Shadow 10px right, 5px down */
box-shadow: -10px -5px 15px rgba(0, 0, 0, 0.5); /* Shadow 10px left, 5px up */

Additional Parameters

  • Blur Radius: Determines how blurred the shadow is. A higher value results in a more blurred shadow.
  • Spread Radius: Expands or contracts the shadow. Positive values increase the size, while negative values decrease it.
  • Color: Defines the color of the shadow, which can include transparency.

Feel free to ask if you need more details or examples!

0 Comments

no data
Be the first to share your comment!