Template:Box-shadow

From Wikipedia, the free encyclopedia
Jump to: navigation, search


Documentation icon Template documentation[view] [edit] [history] [purge]


This template is a shortcut for producing shadows. It generates the CSS for various browsers. Supported browsers are the current versions of Opera, Firefox, Safari, Chrome and Internet Explorer 9.

Usage

Insert this template within a style tag of any element:

{{box-shadow | X-offset | Y-offset | blur radius | #color}}

  • X-offset and Y-offset – Specify the offset of the shadow to the right and below the element. Use negative values for a shadow to the left and above. Default is 4px.
  • blur radius – Specifies the width of blurring added to the shadow border. Default is 4px.
  • color – Specifies the color of the shadow. Default is #CCC;.

Example

  • <div style="background-color: #FFFFDD; border: 1px solid #808000; padding: 5px; {{box-shadow}}">Lorem ipsum...</div> will produce a box with the default border shadow:
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
  • <div style="background-color: #FFFFDD; border: 1px solid #808000; padding: 5px; {{box-shadow|4px|4px|8px|#A0A080}}">Lorem ipsum...</div> will produce a more pronounced and colored shadow:
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

Compatibility

  • See box-shadow on the Mozilla Developer Network for all broswer compatibility details.

See also