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 Справочник » margin-left

margin-left

margin-left

Браузер 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 CSS1
Значение по умолчанию 0
Наследуется Нет
Применяется Ко всем элементам
Аналог HTML Нет
Ссылка на спецификацию http://www.w3.org/TR/CSS21/box.html#propdef-margin-left

Описание

Устанавливает величину отступа от левого края элемента. Отступом является
расстояние от внешнего края левой границы текущего элемента до внутренней границы
его родительского элемента (рис. 1).

Рис. 1. Отступ от левого края элемента

Рис. 1. Отступ от левого края элемента

Синтаксис

margin-left: значение | auto

Аргументы

Величину левого отступа можно указывать в пикселах (px), процентах (%) или
других допустимых для CSS единицах. Значение может быть как положительным, так
и отрицательным числом. Аргумент auto указывает,
что размер отступов будет автоматически рассчитан браузером.

Пример

Валидный 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>margin-left</title>
<style type="text/css">
.layer1 {

background-color: #D36037; /* Цвет фона */
}

.layer2 {
margin-left: 20%; /* Отступ слева */
background-color: #ccc; /* Цвет фона */

padding: 10px; /* Поля вокруг текста */
}
</style>
</head>
<body>

<div class="layer1">
<div class="layer2">
Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diem nonummy nibh
euismod tincidunt ut lacreet dolore magna aliguam erat volutpat. Ut wisis enim
ad minim veniam, quis nostrud exerci tution ullamcorper suscipit lobortis nisl
ut aliquip ex ea commodo consequat.
</div>
</div>

</body>
</html>

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

Рис. 2

Рис. 2. Применение параметра margin-left

Объектная модель

[window.]document.getElementById("elementID").style.marginLeft

Filed under margin-left