WEB/CSS

Box Shadow II

Remoted remoted 2018. 6. 7. 22:47

Box Shadows

Utilities for controlling the box shadow of an element.
ClassProperties
.shadowbox-shadow: 0 2px 4px 0 rgba(0,0,0,0.10);
.shadow-mdbox-shadow: 0 4px 8px 0 rgba(0,0,0,0.12), 0 2px 4px 0 rgba(0,0,0,0.08);
.shadow-lgbox-shadow: 0 15px 30px 0 rgba(0,0,0,0.11), 0 5px 15px 0 rgba(0,0,0,0.08);
.shadow-innerbox-shadow: inset 0 2px 4px 0 rgba(0,0,0,0.06);
.shadow-nonebox-shadow: none;

Outer shadow

Use the .shadow.shadow-md, or .shadow-lg utilities to apply different sized outer box shadows to an element.

.shadow
.shadow-md
.shadow-lg
<div class="shadow"></div>
<div class="shadow-md"></div>
<div class="shadow-lg"></div>

Inner shadow

Use the .shadow-inner utility to apply a subtle inset box shadow to an element. This can be useful for things like form controls or wells.

.shadow-inner
<div class="shadow-inner"></div>

No shadow

Use .shadow-none to remove an existing box shadow from an element. This is most commonly used to remove a shadow that was applied at a smaller breakpoint.

.shadow-none
<div class="shadow-none"></div>

Responsive

To control the shadow of an element at a specific breakpoint, add a {screen}: prefix to any existing shadow utility. For example, use md:shadow-lg to apply the shadow-lg utility at only medium screen sizes and above.

For more information about Tailwind's responsive design features, check out the Responsive Designdocumentation.

all

sm

md

lg

xl

<div class="shadow sm:shadow-md md:shadow-lg lg:shadow-inner xl:shadow-none ..."> <!-- ... --> </div>

Customizing

By default Tailwind provides three drop shadow utilities, one inner shadow utility, and a utility for removing existing shadows. You can change, add, or remove these by editing the shadows section of your Tailwind config.

If a default shadow is provided, it will be used for the non-suffixed .shadow utility. Any other keys will be used as suffixes, for example the key '2' will create a corresponding .shadow-2 utility.

{
// ...
shadows: {
-   default: '0 2px 4px 0 rgba(0,0,0,0.10)',
-   'md': '0 4px 8px 0 rgba(0,0,0,0.12), 0 2px 4px 0 rgba(0,0,0,0.08)',
-   'lg': '0 15px 30px 0 rgba(0,0,0,0.11), 0 5px 15px 0 rgba(0,0,0,0.08)',
-   'inner': 'inset 0 2px 4px 0 rgba(0,0,0,0.06)',
+   '1': '0 2px 4px rgba(0,0,0,0.05)',
+   '2': '0 4px 8px rgba(0,0,0,0.1)',
+   '3': '0 8px 16px rgba(0,0,0,0.15)',
    'none': 'none',
}
}

Responsive and State Variants

By default, only responsive variants are generated for shadow utilities.

You can control which variants are generated for the shadow utilities by modifying the shadowsproperty in the modules section of your Tailwind config file.

For example, this config will also generate hover and focus variants:

{
// ...
modules: {
    // ...
-   shadows: ['responsive'],
+   shadows: ['responsive', 'hover', 'focus'],
}
}

Disabling

If you don't plan to use the shadow utilities in your project, you can disable them entirely by setting the shadows property to false in the modules section of your config file:

{
// ...
modules: {
    // ...
-   shadows: ['responsive'],
+   shadows: false,
}
}


'WEB > CSS' 카테고리의 다른 글

How to bring navigation div to the front  (0) 2019.05.01
[CSS] Media Query에서 Screen과 Only Screen의 차이점  (0) 2019.05.01
Box Shadow II  (0) 2018.06.07
Box-Shadow  (0) 2018.06.07
[CSS] text-justify  (0) 2018.02.05
HTML5 number inputs – Comma and period as decimal marks  (0) 2018.01.24
1 2 3 4 5 6 7 8 9 ··· 16