Deprecated: Assigning the return value of new by reference is deprecated in /home/bahus/data/www/fixblog.ru/css/wp-settings.php on line 468 Deprecated: Assigning the return value of new by reference is deprecated in /home/bahus/data/www/fixblog.ru/css/wp-settings.php on line 483 Deprecated: Assigning the return value of new by reference is deprecated in /home/bahus/data/www/fixblog.ru/css/wp-settings.php on line 490 Deprecated: Assigning the return value of new by reference is deprecated in /home/bahus/data/www/fixblog.ru/css/wp-settings.php on line 526 Deprecated: Assigning the return value of new by reference is deprecated in /home/bahus/data/www/fixblog.ru/css/wp-includes/cache.php on line 103 Deprecated: Assigning the return value of new by reference is deprecated in /home/bahus/data/www/fixblog.ru/css/wp-includes/query.php on line 21 Deprecated: Assigning the return value of new by reference is deprecated in /home/bahus/data/www/fixblog.ru/css/wp-includes/theme.php on line 618 Fix Blog - CSS Справочник » Blog Archive » before

before

before

Браузер Internet Explorer Netscape Opera Safari Mozilla Firefox
Версия 5.5 6.0 7.0 7.0 8.0 7.0 8.0 9.0 2.0 3.0 1.7 1.0 2.0 3.0
Поддерживается Нет Нет Нет Да Да Да Да Да Да Да Да Да Да Да

Краткая информация

CSS CSS2
Значение по умолчанию Нет
Наследуется Нет
Применяется Ко всем элементам
Аналог HTML Нет
Ссылка на спецификацию http://www.w3.org/TR/CSS21/selector.html#before-and-after

Описание

Псевдоэлемент before применяется для отображения желаемого контента до элемента, к которому он добавляется. Псевдоэлемент before работает совместно с атрибутом content.

Для before характерны следующие особенности.

  1. При добавлении before к блочному элементу, значение свойства display может быть только: block, inline, none, marker. Все остальные значения будут трактоваться как block.
  2. При добавлении before к встроенному элементу, значение display ограничено аргументами inline и none. Все остальное будет восприниматься как inline.
  3. Стилевые свойства before наследуются от элемента, к которому он добавляется.

Синтаксис

Элемент:before { content: "текст" }

Аргументы

Нет.

Пример

Валидный HTML Валидный CSS

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1251">
<title>before</title>
<style type="text/css">

li:before {
 content: "? "; /* Добавляем желаемый символ перед элементом списка */
}
li {
 list-style: none; /* Убираем исходные маркеры */

}
</style>
</head>
<body>
<ul>
 <li>Альфа</li>

 <li>Бета</li>
 <li>Гамма</li>
</ul>
</body>
</html>

Результат данного примера продемонстрирован на рис. 1.

Рис. 1

Рис. 1. Использование параметра before в списках

This entry was posted on Четверг, Август 21st, 2008 at 3:56 пп and is filed under before. Both comments and pings are currently closed.

Leave a Reply