- CSS Box Shadow Generator
- What is a CSS Box Shadow Generator, and why should I bookmark it?
- How to use this tool?
- CSS box-shadow генератор
- Синтаксис
- Горизонтальное смещение (по оси X)
- Вертикальное смещение (по оси Y)
- Размытие
- Растяжение
- Цвет
- Внешняя/внутренняя
- Несколько теней
- Круглая тень
- Эффект увеличения с тенью
- Эффект парения элемента с помощью box-shadow
- Тень и свойство clip-path
- Box-shadow generator
- See also
- Found a content problem with this page?
- Box Shadow Generator
- What is Box Shadow Generator?
- How to use Box Shadow Generator
- About the Configuration
- offsetX、offsetY
- blur
- spread
- inset
- color
- preview color
CSS Box Shadow Generator
What is a CSS Box Shadow Generator, and why should I bookmark it?
CSS Box Shadow Generator is a free online tool for web developers to create CSS3 based box-shadow effects with the support for multiple layers.
The CSS box-shadow property is a way to add one or more shadows to an HTML element. It can be set both inwards and outwards. It makes elements look beautiful and adds design character to the elements. With this tool, you can create unique box shadows that match your design requirements.
It is recommended to bookmark it on your web browsers to quickly revisit and reuse it when needed for better productivity at work.
Please share these tools with your friends and colleagues. Also, it will be great if you can recommend these tools in your blogs if you have one. Thank You 🙂
How to use this tool?
Follow these simple steps to get the best results with this tool.
- Step 1 — Import your previous CSS box-shadow values so you can start it from there or ignore this step to crate a new one.
- Step 2 — Choose background color, foreground color, round corners, and size to create the box.
- Step 3 — Create single or multi-layered CSS box shadows, each one with a different blur, spread, color, offset, inset-shadow, and opacity settings. Click + sign button (top-right side) to create more than one layer. Choose color, opacity, blur, spread, offset X, Offset Y of the shadow by dragging the sliders from the left-side panel for each layer.
- Step 4 — After you have created your box shadows and are satisfied with the result, copy the result box-shadow CSS code from the code panel or copy it via the top-left icon by clicking it. You can also click ‘Generate prefixes’ to generate vendor-prefixed for the box-shadow.
Now, save this tool or bookmark it on your web browser to revisit it quickly when needed. Thank you!
webdevpuneet.com © 2021 | hosted by Bluehost (web hosting)
CSS box-shadow генератор
box-shadow — это CSS3 свойство, которое позволяет создавать эффект тени для, практически, любого элемента веб страницы. Оно похоже на эффект Drop Shadows в Photoshop, с помощью этого свойства создается иллюзия глубины на 2-мерных страницах.
Синтаксис
Свойство принимает составное значение из пяти разных частей: горизонтальное смещение, вертикальное смещение, размытие, растяжение, цвет тени. К тому же можно указать будет ли тень внешней или внутренней.
CSS div { box-shadow: offset-x offset-y blur spread color position; }
В отличие от других свойств, каких как border, которые разбиты на подсвойства (border-width, border-style и тд), box shadow CSS стоит особняком. Соответственно, важен порядок, в котором вы записываете значения свойства.
Горизонтальное смещение (по оси X)
Первое значение offset-x — смещение тени по оси X. Положительное значение сместит тень вправо, а отрицательное — влево.
CSS .box-1 { box-shadow: -15px 0 10px 0 rgba(0,0,0,0.2); } .box-2 { box-shadow: 15px 0 10px 0 rgba(0,0,0,0.2); }
Вертикальное смещение (по оси Y)
Второе значение offset-y — смещение тени по оси Y. Положительное значение сместит тень вниз, а отрицательное — наверх.
CSS .box-1 { box-shadow: 0 15px 10px 0 rgba(0,0,0,0.2); } .box-2 { box-shadow: 0 -15px 10px 0 rgba(0,0,0,0.2); }
Размытие
Третье значение (blur) представляет собой радиус размытия тени, посмотрите как он работает на box shadow генераторе выше. Значение 0 означает, что тень будет совсем не размыта, края и стороны будут абсолютно четкие. Чем выше значение, тем более мутную и размытую тень вы получите. Отрицательные значения не допускаются.
CSS .box-1 { box-shadow: 0 5px 0 0 rgba(0,0,0,0.2); } .box-2 { box-shadow: 0 5px 15px 0 rgba(0,0,0,0.2); } .box-3 { box-shadow: 0 5px 30px 0 rgba(0,0,0,0.2); }
Растяжение
Четвертое значение (spread) представляет собой размер тени или дистанции от тени до элемента. При положительном значении тень увеличится, выйдет за пределы элемента. Отрицательное значение уменьшит и сожмет тень.
CSS .box-1 { box-shadow: 0 0 5px 0 rgba(0,0,0,0.2); } .box-2 { box-shadow: 0 0 5px 5px rgba(0,0,0,0.2); } .box-3 { box-shadow: 0 0 5px -15px rgba(0,0,0,0.2); }
Цвет
Цвет тени может быть абсолютно любым и записан в разных форматах, доступных в CSS (HEX, RGB, RGBA и пр), попробуйте разные оттенки в css box shadow generator.
CSS .box-1 { box-shadow: 0 10px 5px -5px #e6ecc1; } .box-2 { box-shadow: 0 10px 5px -5px rgba(30, 129, 204, 0.2); }
Внешняя/внутренняя
Значение inset определяет положение тени. По умолчанию оно не указано, это означает, что тень будет снаружи элемента. Для того, чтобы тень была внутри элемента, необходимо в конце добавить ключевое слово inset.
CSS .box-1 { box-shadow: 10px 10px 10px 2px rgba(34, 60, 80, 0.2) inset; } .box-2 { box-shadow: 10px 10px 10px 2px rgba(34, 60, 80, 0.2); }
Несколько теней
В CSS тень блока может быть не одна. Чтобы добавить несколько теней, достаточно написать их в одном свойстве через запятую.
CSS .box-1 { box-shadow: 10px 10px 10px 2px rgba(34, 60, 80, 0.2) inset, 10px 10px 10px 2px rgba(34, 60, 80, 0.2); }
Круглая тень
Тень может быть круглой, для этого достаточно добавить свойство border-radius
CSS .box-1 { box-shadow: 10px 10px 10px 0px rgba(34, 60, 80, 0.2); border-radius: 50%; }
Эффект увеличения с тенью
Используя свойства box-shadow и transform, можно создать иллюзию приближения и отдаления элемента от пользователя.
CSS .box-1 { transform: scale(1); box-shadow: 0 0 5px 5px rgba(34, 60, 80, 0.2); transition: box-shadow 0.5s, transform 0.5s; } .box-1:hover { ransform: scale(1.2); box-shadow: 0 0 15px 7px rgba(34, 60, 80, 0.2); transition: box-shadow 0.5s, transform 0.5s; }
Эффект парения элемента с помощью box-shadow
Мы можем добавить тень к псевдоэлементу :after и создать тень ниже элемента. Тем самым создавая иллюзию, что элемент был поднят вверх, а потом упал.
CSS .box-1 { position: relative; transform: translateY(0); transition: transform 1s; } .box-1::after { content: ""; display: block; position: absolute; bottom: -30px; left: 50%; height: 8px; width: 100%; box-shadow: 0px 0px 15px 0px rgba(0, 0, 0, 0.4); border-radius: 50%; background-color: rgba(0, 0, 0, 0.2); transform: translate(-50%, 0); transition: transform 1s; } .box-1:hover { transform: translateY(-40px); transition: transform 1s; } .box-1:hover::after { transform: translate(-50%, 40px) scale(0.75); transition: transform 1s; }
Тень и свойство clip-path
Тень возможно сделать не только на элементах в виде блока или круга, но и на более сложных формах с использованием свойства clip-path . Правда свойство box-shadow при этом не сработает и нам придется заменить его другим. Приступим, создадим элемент box-1.
CSS .box-1 { clip-path: polygon(30px 0%, 100% 0%, 100% 100%, 30px 100%, 0 50%); }
В CSS существует фильтр, который тоже делает CSS тень блока — drop-shadow() . Но у вас не поучится использовать его непосредственно на элементе, так как clip-path просто отрежет эту тень. Поэтому создаем родительский блок и наложим тень на него.
CSS .box-1__wrapper { filter: drop-shadow(-1px 6px 3px rgba(34, 60, 80, 0.2)); } .box-1 { clip-path: polygon(30px 0%, 100% 0%, 100% 100%, 30px 100%, 0 50%); }
- Студия Профессиональная разработка сайтов под заказ Подробнее
- Иконки Прекрасный способ визуально выразить главную мысль Подробнее
- Сервисы Полезные инструменты для веб разработчиков Подробнее
- Блог Делимся в опытом и знанием в IT сфере Подробнее
- Поделиться ВконтактеFacebook Контакты support@active-vision.ru
© 2019 — 2023 Active-Vision. Политика конфиденциальности. Вся информация на сайте носит справочный характер и не является публичной офертой, определяемой статьей 437 ГК РФ
Box-shadow generator
This tool lets you construct CSS box-shadow effects, to add box shadow effects to your CSS objects.
The box-shadow generator enables you to add one or more box shadows to an element.
On opening the tool, you’ll find a rectangle in the top-right section of the tool. That’s the element you’re going to be applying shadows to. When this element is selected (as it is, when you first load the page) you can apply some basic styling to it:
- Set the element’s color using the color picker tool.
- Give the element a border using the «border» checkbox.
- Use the sliders to set the element’s top , left , width , and height properties.
To add a box shadow, click the «+» button at the top-left. This adds a shadow, and lists it in the column on the left. Now you can set the values of the new shadow:
- Set the shadow’s color using the color picker tool.
- Set the shadow to be inset using the «inset» checkbox.
- Use the sliders to set the element’s position, blur, and spread.
To add another shadow, click «+» again. Now any values you set will apply to this new shadow. Change the order in which these two shadows are applied using the ↑ and ↓ buttons at the top-left. Select the first shadow again by clicking it in column on the left. To update the element’s own styles, select it by clicking the button labelled «element» along the top.
You can add ::before and ::after pseudo-elements to the element, and give them box shadows as well. To switch between the element and its pseudo-elements, use the buttons along the top labeled «element», «:before», and «:after».
The box at the bottom-right contains the CSS for the element and any before:: or ::after pseudo-elements.
See also
This interactive tool lets you visually create border images (the border-image property).
This interactive tool lets you visually create rounded corners (the border-radius property).
Found a content problem with this page?
This page was last modified on May 24, 2023 by MDN contributors.
Your blueprint for a better internet.
Box Shadow Generator
A generator that can generate CSS box-shadow interactively.
What is Box Shadow Generator?
Generator of CSS box-shadow property.
You can easily generate a box-shadow of your choice while checking the preview that changes in real time.
How to use Box Shadow Generator
As you manipulate each setting in the configuration area, box-shadow is applied to the preview in the output area in real time.
Each setting corresponds to a property of box-shadow. The values are described below, but if you need more information about box-shadow, please refer to MDN’s documentation.
box-shadow — CSS: Cascading Style Sheets | MDN
About the Configuration
offsetX、offsetY
offsetX and offsetY set the offset of the shadow.
offsetX represents the horizontal distance. Positive values set the shadow to the right negative values set the shadow to the left. offsetY is the vertical distance. Positive values set the shadow downward; negative values set the shadow upward.
If both are 0, they are set behind the element to which the shadow is applied.
blur
blur allows you to set the blurring of shadows. The higher the value, the greater the blur. As a result, the area of the shadow becomes larger and the color of the shadow becomes lighter.
spread
spread allows you to set the spread of the shadow. The larger the value, the larger the shadow. 0 means the shadow is the same size as the element.
inset
When inset is turned on, the shadow is set inside the element.
color
You can specify the color of the shadow. Selecting the color box area displays a color palette, allowing you to change the color.
preview color
This setting does not directly affect the box-shadow CSS, but allows you to change the preview box color and background color, respectively.