Css text-shadow

Text-shadow exposed: make cool and clever text effects with css text-shadow

How to Add Shadow Effect on Text HTML With Shadow Color

To create a simple shadow effect, you have to simply add pixel size and color. The added color in the property displays the shadow of the text. You may also like to read how to add a shadow effect to the div element using CSS.

Example

XHTML

<style>
.simple-shadow{
text-shadow: 1px 2px 2px red;
}
</style>
<p class=»simple-shadow»>Simple text shadow with shadow color.</p>

1
2
3
4
5
6

<style>

.simple-shadow{

text-shadow1px2px2pxred;

}
</style>

<p class=»simple-shadow»>Simple text shadow with shadow color.</p>

Output

The above example showing the simple shadow with red color. However, you can change the color and the pixel size as per your requirement. Add your own color which fits best to your text color.

Pretty Shadow by

As its name suggests, Pretty Shadow by Alex Moore, is able to show you pretty and perfect texts’ styles for your sites.

Pretty Shadow comes with a blue design that can draw your visitors’ attention. Along with that, there is a design text `Pretty Shadow` standing in the middle to help you check how this text-shadow performs on your sites. As you can see, this shadow effect is quite lovely in order to make itself become a highlighter. Using the Google font to feature its function, Pretty Shadow is a must-have in your list of top text-shadow effects.

If you want to experience one of the most widely used text-shadow effects, then why don’t you take a little time to download and install this effect on your sites.

Animated Text-Shadow by

A fun and amazing text shadow is just right in front of you. Animated Text Shadow is what we are talking about.

Created by Erin E, Sullivan, as its name suggests, this effect contains not only shadow but also animation on texts. As you can see, the dark-green text `Lorem ipsum dolor sit amet` is highlighted on the white background. As you can see, a shadow on texts is applied to each letter and it seems to create a colorful shadow. In addition, unlike other text-shadow effects, Animated Text Shadow is animated to generate a bounce while still mimicking an RGB separation during the whole process. Whenever you place your mouse on those demo texts, they jump up and stay still after a few seconds. This will make your sites become eye-catching and visitors will feel hard to take their eyes off your screen.

Hence, we hope that after reading this review, you can spend a little time on downloading Animated Text Shadow for free and apply it to your sites right now.

Text-Shadow by

Text-Shadow, by Mayur Elbhar, is the most common text-shadow effects for any purposes. If you are finding ways to make your sites attractive, this text-shadow will be a useful tool.

Text-Shadow is loaded with a simple design. It has a green background and a demo text-shadow `Play at Your own Risk`. This kind of design is mainly applied for heading texts or important dialogues. This effect has text-shadow leaning more to the left and also the shadow is clearly shown on its own ways. Visitors will be impressed by this text-shadow since they can focus on what they are looking at and find out your real messages.

To experience all of the amazing features of Text-Shadow, all you need to do is to download and apply it to your sites without thinking of anything.

Основы использования теней

Свойство text-shadow очень просто использовать. Оно поддерживается всеми современными браузерами и даже без использования префиксов. Но поддержка в IE (даже в IE9) отсутствует. Можно использовать инструменты, например, Modernizr, которые помогут вытянуть эффекты CSS3 даже в старых версиях IE.

Синтаксис

Для создания тени текста используется синтаксис свойства text-shadow, который приводится ниже. Нужно определить четыре параметра: первые два задают положение тени, третий устанавливает уровень размытия, а четвертый определяет цвет тени.

text-shadow: смещение_по_горизонтали  смещение_по_ вертикали размытие цвет;

Ниже приводится пример тени текста, которая смещена на два пикселя вниз и на четыре пикселя вправо, размыта на три пикселя и имеет черный цвет с уровнем непрозрачности 30%.

text-shadow: 2px 4px 3px rgba(0,0,0,0.3);

Результат использования данного свойства будет выглядеть следующим образом:

Почему используется rgba?

Вам не обязательно использовать rgba для задания цвета тени при определении свойства. Однако, rgba добавляет еще одну размерность при определении тени — уровень прозрачности.

Данный метод существенно проще, чем другие способы определения цвета

Вам не надо акцентировать внимание на определении оттенка цвета тени, который может быть лишь немного темнее или светлее цвета фона. С rgba вы можете просто использовать белый или черный цвета и увеличить их прозрачность, чтобы добиться нужного оттенка фона при смешении красок

Browser compatibility

The compatibility table in this page is generated from structured data. If you’d like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.

Chrome Edge Firefox Internet Explorer Opera Safari Android webview Chrome for Android Firefox for Android Opera for Android Safari on iOS Samsung Internet
Chrome
Full support

2
Edge
Full support

12
Firefox
Full support

3.5
Notes
IE
Full support

10
Opera
Full support

9.5
Notes
Safari
Full support

1.1
Notes
WebView Android
Full support

37
Chrome Android
Full support

18
Firefox Android
Full support

4
Notes
Opera Android
Full support

14
Safari iOS
Full support

1
Notes
Samsung Internet Android
Full support

1.0

Quantum CSS notes

Gecko has a bug whereby transitions will not work when transitioning from a text-shadow with a color specified to a text-shadow without a color specified (bug 726550). This has been fixed in Firefox’s new parallel CSS engine (also known as Quantum CSS or Stylo, planned for release in Firefox 57).

Quick and Dirty Letterpress

The great thing about text-shadows is that you can actually do a lot more with them than your average drop shadow. For instance, here’s a quick trick for creating the illusion of inset text.

The first thing you want to do is set your text color to a slightly darker shade than your background color. Next, apply a slight white text-shadow with a reduced opacity.

As you can see, I used a background color of #222 and then set the text to black at 60% opacity. Finally, my white shadow was positioned just slightly down and to the right with a 10% opacity.

1
2
3
4
5
6
7
8

body{

background#222;

}
 
#text h1 {

colorrgba(,,,0.6);

text-shadow2px2px3pxrgba(255,255,255,0.1);

}

Add Blurred Shadow Effect on Text

Add a blurry shadow effect to the HTML text with white in color. A blurred shadow appears as a blur with the blurry edges. The shadow split into different shades and the result is a blurred shadow with text.

Example

XHTML

<style>
.blurr-shadow{
text-shadow:2px 2px 5px #101010;
color:#fff;
}
</style>
<p class=»blurr-shadow»>White Text with Blur Shadow Effect.</p>

1
2
3
4
5
6
7

<style>

.blurr-shadow{

text-shadow2px2px5px#101010;

color#fff;

}
</style>

<p class=»blurr-shadow»>White Text with Blur Shadow Effect.</p>

Output

The above example contains the blurred shadow and the white-colored text. Increase or decrease the third-pixel value of property to add a more blurry effect to the content. Add shadow effect on text HTML with blur shadow effect.

Текстовые тени для нормальных браузеров

Под нормальные браузеры попали все современные браузеры, которые шагают более-менее в ногу с рекомендациями W3C. В данном случае, эти браузеры понимают CSS3 свойство text-shadow, которое было рекомендовано еще в далеком году.

Итак, перечень браузеров, которые поддерживают свойство text-shadow:

  • Safari 3.1 (Mac/Win) — поддерживает, не поддерживаются множественные тени
  • Safari 4 (Mac/Win) — поддерживает полностью
  • Opera 9.5+ (Mac/Win/Lin) — поддерживает полностью
  • Firefox 3.1/3.5 (Mac/Win/Lin) — поддерживает полностью
  • Google Chrome 2 (Win) — поддерживает полностью
  • Shiira (Mac) — поддерживает, не поддерживаются множественные тени
  • Konqueror (Lin/Mac/Win) — поддерживает полностью
  • iCab (Mac) — поддерживает, не поддерживаются множественные тени
  • Safari on iPhone — поддерживает, не поддерживаются множественные тени
  • Nokia Symbian-Smartphones (Series 60) — поддерживает
  • Opera Mini 4.1 — поддерживает, не поддерживает размытость тени

Для этих браузеров, чтобы сделать тень тексту достаточно одной строки в CSS:

h1 {
	text-shadow: 0px 1px 3px #000;
}

Получим вот такой модный заголовок:

заголовок с тенью

Подробный синтаксис смотри в описании CSS свойства text-shadow.

С помощью text-shadow можно добиться различных интересных эффектов.

h1 {
	color: #fff;
	background: #666;
	text-shadow: 0px 0px 3px #fff;
}

размытый заголовок

Дублирование текста

h1 {
	text-shadow: 0px 20px #000;
}

продублированный заголовок

Множественные тени позволяют добиться еще нескольких эффектов:

Вдавленный текст

h1 {
	background: #ccc;
	color: #ccc;
	text-shadow: -1px -1px #666, 1px 1px #FFF;
	font-family: serif;
}

вдавленный текст

Выпуклый текст

h1 {
	background: #999;
	color: #999;
	text-shadow: 1px 1px 3px #666, -1px -1px 3px #FFF, 1px 1px #666, -1px -1px #FFF;
	font-family: serif;
}

выпуклый текст

Теперь о грустном — что делать с горячо всеми «любимым» IE?

Add Outline Shadow Effect on HTML Text

You can create an outline effect on the text content. Add 4 shadow effect to the text content to add an outline shadow effect to the text content. However, this is another type of multiple shadow effect. You have added 4 shadows to the text content for this.

Example

XHTML

<style>
.outline-shadow{
text-shadow: 1px 1px #000, -1px 1px #000, -1px -1px #000, 1px -1px #000;
color:#fff;
}
</style>
<p class=»outline-shadow»>Text with outline shadow effect.</p>

1
2
3
4
5
6
7

<style>

.outline-shadow{

text-shadow1px1px#000,-1px1px#000,-1px-1px#000,1px-1px#000;

color#fff;

}
</style>

<p class=»outline-shadow»>Text with outline shadow effect.</p>

Output

The above example creates a plain border around each word of text content. The outline effect can be useful when you want to add 3D text HTML content.

  • Define CSS for Internet Explorer and add IE-only stylesheet
  • How to change background transparency of div element

I hope you like this post on how to add shadow effects to text HTML using CSS.

What Are CSS Shadow Effects?

Shadow effects are a popular design technique that can add depth and dimension to an element. They are commonly used in web design to create the appearance of depth and space within a flat, two-dimensional layout. A shadow is an area of darkness created by an object blocking a light source.

In design, shadows can be created using drop shadow, horizontal shadow position, layered shadows, blur effect, box shadow, and text-shadow. Using shadows can make a design look more dynamic and visually exciting and help create a sense of hierarchy or emphasis. In this article, we will explore the different types of shadow effects and how they can be used to make a statement in your designs.

Long Shadow Gradient Mixin by

Long Shadow Gradient Mixin, developed by roikles, is a useful tool to make your boring texts become lively. Thanks to the application of shadow-effect, this text-shadow effect will not let you down.

Take note that visitors might feel bored with long texts; however, you sometimes find it hard to shorten them. Hence, it is considered a good idea to add something to those texts. With this effect, an SCSS mixin quickly creates long shadow gradients, and it is suitable for both text-shadow and box-shadow. All you have to do is to add your long texts on the white demo letters to see how they look like on your sites. In spite of simple design; followed by an orange background, Long Shadow Gradient Mixin still occupies its users’ love thanks to its amazing feature of bringing their visitors’ high-quality websites.

Now, it is time for you to sit down for a while, download this effect, and apply it to your sites immediately.

Variable Longshadow With Gradients Mixin by

If you have not heard of Variable Longshadow With Gradients Mixin, you should read this review. In this review, we are going to introduce to you a long text-shadow effect, created by Dario Corsi.

Variable Longshadow With Gradients is truly a colorful text-shadow effect. Besides its long names, this effect contains a cool design. As you can see, standing in the yellow background is the demo text Variable Spread Long Shadows With Gradients. Each word is loaded with different shadow colors. You are able to define ling shadows with different colors as well as spreads with a SASS Mixin. In general, the effect provides visitors with a rainbow-likely text, which are suitable for younger viewers and keep them staying longer on your sites.

No matter what kind of devices you are using, Variable Longshadow With Gradients is strongly recommended to use. You will love this effect just after one click of downloading and installing.

#2. Which browsers support it

In fact, text-shadow is not a new property since it was first defined with but it was just implemented by the KHTML/WebKit-folks. But it’s available in Safari since version 1.1 (2003), in Konqueror since version 3.4 (I believe, not sure) and Opera 9.5. Furthermore it’s also supported by Firefox 3.1/3.5 and finally Google Chrome 2 adds full support for the text-shadow property after they had stripped this from the first version of Chrome.

On the Mac platform WebKit is also used in various other programs with a browser included like Coda from Panic, CSSedit from MacRabbit or NetNewsWire from NewsGator. Also every browser which is powered by the WebKit engine is able to render the text-shadow property, like Shiira, OmniWeb or Epiphany which are either for Mac or Linux.

But with Safari 3.1, the beta release of Opera 9.5, Firefox 3.1 and Google Chrome 2 the text-shadow property is finally finding it’s way to the Windows desktop after 10 years of it’s birth and Opera is the first non-WebKit browser which supports text-shadow.

But wait, regarding Safari on Mac OS X there’s one more (bad) thing to remember. The Mac OS X 10.5.2 update resulted in minor changes of the WebKit text-shadow rendering. It seems that with this update text-shadow is finally rendered correctly as WebKit added one extra pixel to the shadow offset on 10.4.11 and 10.5.1.

Giving multiple shadows

You can also give more than one shadow to some text to give different shadow effects. These values are given, separated by commas, to the property.

For example, consider the following code.

CSS

.text {
  text-shadow 3px px 7px rgba(81,67,21,0.8), -3px px 7px rgba(81,67,21,0.8);
}

Here, two shadow values have been given to the  property, separated by comma. The first value will draw a shadow on the right side of the text, while the second one will draw a shadow on the left side of the text.

Consider some more examples where multiple shadows are given.

See the Pen Giving multiple text shadows by Aakhya Singh (@aakhya) on CodePen.

#5.3 Make your text glow

By utilizing the blur radius we can achieve some interesting effects. Here’s some subtle glowing white text on a black background:

I’m subtle glowing text


image

You can also make the whole text blurry by using the same color for text and shadow with no offset:

I’m also glowing but more blurry


image

We can make it quite mysterious by using the same color for text and background and make the text just visible through text-shadow. Remember that the same color for text and background can be bad for usability…:

I’m pretty mysterious looking text


image

Or the other way around to make it look light and… milky:

I’m pretty milky looking text


image

Groovy CSS Effect by

Created by Daniel Gonzalez, Groovy CSS Effect is an amazing text-shadow effect that you should not miss out.

Groovy CSS Effect is loaded with an impressive design; followed by a yellow background and `Good Vibes Only` texts. If somebody looks at this effect for the first time, it definitely brings him or her back to the old day. Groovy CSS Effect’s style seems to be old-age, however, the combination of 1960’s font effect with CSS text-shadow does not make itself old-fashioned. On the contrary, it makes a difference for your websites and keeps visitors staying longer on your sites. One more thing is when you place your mouse on those demo words, there is even the sparkle on them.

Hence, let’s take a closer step to download and use this text effect immediately. Don’t forget to share with us your comments.

Blurred Shadow

The text-shadow property can be used in combination with the blur-radius attribute to create a blurred shadow.

Now, let’s say we want to create a shadow that is offset by 3px on both the horizontal and vertical axes and has a 2px blur effect surrounding the shadow. We could create this shadow using the following code:

<html>

<h1>Career Karma</h1>

<style>

h1 {
	text-shadow: 3px 3px 2px pink;
}

Click the

button in the code editor above to see the output of our HTML/CSS code.

As you can see, our shadow is offset by 3px on both axes, and our shadow is surrounded by a blur effect. To intensify our blur effect, we could increase the value of the blur-radius attribute. If we wanted a more blurry shadow, we could set the value of blur-radius to 5px, or 10px, or higher, depending on the blur we want to use. In this example, our shadow is pink.

Basic Text Shadow

There are only two required attributes you need to specify when working with the text-shadow property: offset-x and offset-y. If we specify these two properties, we can create text with a horizontal and vertical shadow.

Here’s an example of the text-shadow property with both these values specified:

<html>

<h1>Career Karma</h1>

<style>

h1 {
	text-shadow: 1px 1px;
}

Click the

button in the code editor above to see the output of our HTML/CSS code.

In our code, we applied a simple text-shadow to our header. This shadow is offset by 1px on both the horizontal and vertical axes. If you look at the result of our code, you can see there is a slight black shadow applied beneath our text. Black is the default color for a shadow.

«Career Karma entered my life when I needed it most and quickly helped me match with a bootcamp. Two months after graduating, I found my dream job that aligned with my values and goals in life!»

Venus, Software Engineer at Rockbot

Find Your Bootcamp Match

Text Shadow Effect by

Text Shadow Effect, by Soumyajit Pathak, is a lovely text-shadow effect. In spite of a simple designs, Text Shadow Effect play an important role in drawing your visitors’ attention.

As you can see, Text Shadow Effect contains a white background and the demo of the two cute heart pictures. The text-shadow effect is shown clearly when the yellow heart is the shadow of the green heart. Whenever you move your mouse, the two hearts will follow your direction and create the axis of the symmetry. More interestingly, when the two hearts overlap together, it turns into pink. Text Shadow Effect helps you in holding back your visitors on your sites.

For those who do not need complicated things, this text shadow effect is a must-have item. You are able to download this effect for free and apply it to your sites immediately.

SCSS 3D Text Mixin by

Being compatible with many browsers, like Chrome, Firefox, Edge, Safari or Opera, the SCSS 3D Text Mixin is another text-shadow effect that should not be missed out.

If you are looking for an effect that aids in bringing an amazing heading for your stories, why don’t you take a closer look at SCSS 3D Text Mixin, developed by Liam Egan. This text effect is loaded with a simple but cool design; followed by a pink background with Braille-likely lines `I am a 3D (not really, tho) heading`. In fact, it works well as a simple SCSS mixin which can create 3D blocky looking text with text shadows.

Hence, in order to get your visitors’ first impression, you can download this text-shadow effect for headings and see the differences.

Values

These parameters are defined below.

  1. horizontal offset (required) : This is the horizontal distance of the shadow from the text. A positive horizontal offset will place the shadow on the right side of the text while a negative horizontal offset will place the shadow on the left side of the text.
  2. vertical offset (required) : This is the vertical distance of the shadow above or below the text. A positive vertical offset will place the shadow on the bottom side of the text while a negative vertical offset will place the shadow on the top side of the text.
  3. blur radius (optional) : Giving blur radius makes the shadow blurred. A higher value of blur radius will make the shadow more blurred and extended, thus making it bigger and lighter. On the other hand, a smaller value of blur radius will result in a sharper, brighter and less extended shadow. Negative values are not allowed.
  4. color (optional) : This specifies the color of the shadow.

Let’s understand this with an example. The following code will change the font size and color of the text.

HTML

<p>Text Shadow</p>

CSS

p {
  font-family 'Muli', sans-serif;
  font-size 47px;
  font-weight 900;
  color #CFC547;
}

Now, let’s draw a shadow for this text considering the effect of each of the above parameters.

horizontal offset

If you want shadow only on the left or right side of the text, then give the value of vertical offset 0.

To place the shadow on the right side of the text, give a positive horizontal offset value.

CSS

.text {
	text-shadow 3px  rgba(81,67,21,0.8);
}

A negative value will place the shadow on the left side of the box.

CSS

.text {
	text-shadow -3px  rgba(81,67,21,0.8);
}

See the Pen Setting horizontal offset for text shadows by Aakhya Singh (@aakhya) on CodePen.

In the above code, rgba(81,67,21,0.8) is the color of the shadow. If no shadow color is given, then the color of the text shadow will be the same as that of the text.

vertical offset

Same as in the above case, give 0 horizontal offset if you want the shadow to be only at the top or bottom of the text.

A positive vertical offset value will place the shadow on the bottom side of the text.

CSS

.text {
	text-shadow  4px rgba(81,67,21,0.8);
}

A negative value will place the shadow on the upper side of the text.

CSS

.text {
	text-shadow  -4px rgba(81,67,21,0.8);
}

See the Pen Setting vertical offset for text shadows by Aakhya Singh (@aakhya) on CodePen.

If you want a bottom-right shadow, then give both the horizontal offset and the vertical offset positive.

CSS

.text {
	text-shadow 3px 4px rgba(81,67,21,0.8);
}

See the Pen Bottom-right text shadow by Aakhya Singh (@aakhya) on CodePen.

blur radius

Blurring makes a shadow look real. To give a blurred effect to the shadow, give it some positve blur radius.

CSS

.text {
	text-shadow 3px 4px 7px rgba(81,67,21,0.8);
}

See the Pen Bottom-right blurred text shadow by Aakhya Singh (@aakhya) on CodePen.

color

You can give a color to the shadow by giving any color name or color value (like rgba or hsla). It gives a nice and a more natural look to the shadow if the opacity is set to a value less than 1 (as in the above case, where the opacity is set to 0.8).

CSS3 Учебник

CSS3 Закругленные углыCSS3 Изображен. границаCSS3 Слои фона изображ.CSS3 ЦветаCSS Ключевые сл. цветаCSS3 Градиент
Линейные градиенты
Радиальные градиенты
Конические градиенты

CSS3 Тени
Теневые эффекты
Тени бокса

CSS3 Эффект текстаCSS3 Веб шрифтыCSS3 2D ТрансформацияCSS3 3D ТрансформацияCSS3 ПереходCSS3 АнимацияCSS3 Всплыв. подсказкиCSS3 Стиль изображенияCSS3 Отраж. изображенияCSS3 Объект-подгонкаCSS3 Объект-позицияCSS3 МаскировкаCSS3 КнопкиCSS3 ПагинацияCSS3 Несколько столбцовCSS3 ИнтерфейсCSS3 Переменные
Переменная var()
Переопределение
Переменные с JS
Медиа-запросы

CSS3 Размеры боксовCSS3 Медиа запросыCSS3 Медиа примерыCSS3 Флексбокс
CSS Гибкий бокс
CSS Flexbox контейнер
CSS Flexbox элементы
CSS Flexbox отзывчивый

Sass Text Shadow Effect by

Created by alfabill, Sass Text Shadow Effect, is another text-shadow effect that we want to introduce to you in this post.

Containing a simple but beautiful design, Sass Text Shadow Effect is loaded with a yellow background; followed by colorful shadow effects on texts. You can see that different colors on texts lead to different colors on the shadows, which makes your sites become unique and lively. Also, you should take note that this effect is suitable for short headlines only. Visitors will concentrate on your headlines because of not only its messages but also this amazing text-shadow effect.

If you want to try on this effect, don’t forget to spend a few seconds on downloading and installing it. Let’s share us your comments on what you think of Sass Text Shadow Effect.

Пример использования

Давайте рассмотрим пример добавления текстовой тени к абзацу (элемент <p>):

<!DOCTYPE html>
<html>
<head>
	<title>Пример использования свойства text-shadow в CSS</title>
<style> 
p {
color: #fff; /* устанавливаем цвет текста белый*/	
text-shadow: 1px 1px 4px #000; /* размещаем текстовую тень*/	
} 
p::selection { /* описание псевдоэлемента, который позволяет стилизовать выделенный пользователем текст */
background-color: orange; /* устанавливаем цвет заднего фона */
text-shadow: 1px 1px 4px #fff; /* размещаем текстовую тень*/	
color: #000; /* устанавливаем цвет текста черный */		
} 
p::-moz-selection { /* описание псевдоэлемента для браузера Firefox (дублируем стили) */
background-color: orange; /* устанавливаем цвет заднего фона */
text-shadow: -1px -1px 4px #fff; /* размещаем текстовую тень*/	
color: #000; /* устанавливаем цвет текста черный */		
} 
</style>
</head>
	<body>
		<p>Текст с добавленной тенью.</p>
		<p>Текст с добавленной тенью.</p>
	</body>
</html>

В этом примере мы для всех азацев (элемент <p>) установили цвет текста белый, а для текстовой тени (свойство text-shadow) установили значения для расположения горизонтальной и вертикальной тени равными 1 пиксель, а радиус размытия установили равным 4 пикселям.

Кроме того, с использованием псевдоэлемента ::selection задали следующие стили для всех абзацев при выделении текста пользователем: цвет текста черный, цвет заднего фона оранжевый, значения для расположения горизонтальной и вертикальной тени установили равными -1 пиксель (тень сдвигается в противоположную сторону), а радиус размытия установили равным 4 пикселям.

Результат нашего примера:


Рис. 68 Пример использования свойства text-shadow (текстовая тень).

Множественная текстовая тень

Допускается добавление нескольких текстовых теней к элементу, для этого необходимо добавить дополнительное значение тени, либо теней, разделяя их при этом запятыми. Множественные тени наносятся по z-оси спереди назад (с первой заданной тенью сверху).

Пример блока объявлений для множественной тени:

.multipleShadow {
text-shadow: -2px 3px 1px #777, 1px 2px 3px red; /* добавляем множественную тень */	
}

Давайте рассмотрим следующий пример:

<!DOCTYPE html>
<html>
<head>
	<title>Пример создания множественной текстовой тени</title>
<style> 
.test {
text-align: center; /* устанавливаем горизонтальное выравнивание текста по центру */
line-height: 150px; /* задаем высоту строки */
text-shadow: 0 0 4px white, 0 -5px 4px violet, 2px -10px 6px indigo, -2px -15px 11px blue, 2px -25px 18px green, -2px -40px 25px yellow, 2px -60px 33px orange, 0px -85px 40px red; /* используем 8 теней в одном объявлении */
} 
.test2 {
text-shadow: 6px 6px 2px rgba(255, 0, 0, 0.5); /* устанавливаем тень смещенную вправо */
} 
.test3 {
text-shadow: -6px 6px 2px rgba(0, 255, 0, 0.5); /* устанавливаем тень смещенную влево */
} 
.test4 {
text-shadow: 0px 0px 6px rgba(0, 0, 255, 0.5); /* используем только радиус размытия, получая неоновый эффект */
} 
</style>
</head>
	<body>
		<div class = "test">Радужный текст</div>
		<div class = "test2">Текст с добавленной тенью</div>
		<div class = "test3">Текст с добавленной тенью</div>
		<div class = "test4">Текст с добавленной тенью</div>
	</body>
</html>

В данном примере мы применили множественную тень (8 теней) к первому элементу, установили для него высоту строки 150px (свойство line-height) и задали горизонтальное выравнивание по центру (свойство text-align со значением center). Для следующих блоков указали как положительное значение для горизонтальной тени, так и отрицательное, благодаря чему тень смещается в левую, а не правую сторону.

Для последнего блока мы установили радиус размытия 6px, а значения горизонтальной и вертикальной тени указали 0px, что придает некий неоновый эффект.


Рис. 68а Пример создания множественной текстовой тени.CSS свойства

Final Words on These CSS Shadow Effects

Having a clean and aesthetically beautiful website does not need to be a complicated task. With a simple CSS Shadow Effects technique, you can elevate your website appearance from mediocre to stunning, elegant, and beautiful.

By learning all about shadows, you are well on your way to becoming a shadow expert! Practice makes perfect when designing shadows and finding your style. You can use box-shadow layers to get creative with the designs of elements or combine colors for a personalized look. To make sure the shadow looks great on all devices, it is essential to test them out.

If you enjoyed reading this article about CSS shadow effects, you should read these as well:

  • How to Create a Stunning Hero Slider for Your Real Estate Website
  • Websites with Video Background That Integrate It Properly
  • Unique Website Design Examples To Use As Inspiration

CSS Shadow Effects That Make a Statement

Awesome Text-Shadow by

Written by Nguyen Hoang Nam, Awesome Text-Shadow is one of the most widely used text-shadow effects that should not be ignored.

As its name suggests, this text-shadow is awesome and useful. Containing a simple but cool design, Awesome Text-Shadow brings a new look to your websites thanks to the braille letters `Harder – Better – Faster – Stronger`. Although the background and letters’ colors are the same, those demo texts remain outstanding by the shadow effect. Viewers can still see your messages and they might find hard to take their eyes off your screens.

Therefore, all you need to do now is to spend a few seconds on downloading and apply this effect to your sites. Don’t forget to leave us comments and we are sure that Awesome Text-Shadow will never let you down.

#5.2 Apple style (engraved text on metal)

With those lines you get this engraved-text-on-metal effect often used by Apple. You should use a grey background and a very dark text color for this. It’s nothing more than a white or light grey shadow which is placed 1px below the text. You can use a blur of 1 to make it look more round. I’ve used bold text to make the effect more visible:

I’m engraved text

image

This even works the other way around on a black background with grey text by adjusting only the color values:

I’m engraved text on black

image

Or you can make this one which looks like the text stands out from the background:

I’m on top of the background

image

Понравилась статья? Поделиться с друзьями:
Setup Pro
Добавить комментарий

;-) :| :x :twisted: :smile: :shock: :sad: :roll: :razz: :oops: :o :mrgreen: :lol: :idea: :grin: :evil: :cry: :cool: :arrow: :???: :?: :!: