Свойство CSS font
Свойство CSS font отвечает за внешний вид текста (форматирование): размер шрифта, стиль шрифта, расстояние между строками, толщина линий.
font: [font-style||font-variant||font-weight] font-size [/line-height] font-family | inherit;
- font-style — стиль шрифта:
- normal — обычное начертание (по умолчанию)
- italic — курсивный текст
- oblique — наклонное текст (немного меньше, чем курсив)
- inherit — применяется значение родительского элемента
- normal — обычное начертание (по умолчанию)
- small-caps — весь текст выводится в виде маленьких прописных букв
- inherit — применяется значение родительского элемента
- normal — обычный размер шрифта (400)
- bold — жирный размер (700)
- bolder — увеличивает степень жирности
- lighter — уменьшает степень жирности
Более подробно читайте в статье: свойство font-weight. Также ознакомьтесь: какой выбрать шрифт для сайта »
- Ariel
- Verdana
- Times New Roman
- Calibri
- Georgia
- Impact
Помимо этих значений font может принимать значения «константы»:
Свойства font-style , font-variant , font-weight , font-size , line-height , font-family можно использовать отдельно (независимо) друг от друга.
Как изменить стиль и оформление текста в html
Пример 1. Шрифт 15px, Ariel, Italic
html> head> style> .primer1< font: italic 15px/30px Arial; > /style> /head> body> div class css">primer1">Пример №1. Текст со свойством italic 15px/30px Arial. Расстояние между строками 30 пикселей/div> /body> /html>
На странице преобразуется в следующее
Пример 2. Шрифт 16px, Calibri, жирный (bold)
html> head> style> .primer2< font-size: 16px; font-family: Calibri; font-weight: bold; font-style: oblique; > /style> /head> body> div class css">primer2">Пример №2. Текст со свойством font-size: 16px;font-family: Calibri;font-weight: bold;font-style: oblique; /div> /body> /html>
На странице преобразуется в следующее
Пример №2. Текст со свойством font-size: 16px; font-family: Calibri; font-weight: bold; font-style: oblique;
Пример 3. Font: caption
Пример: готовый шрифт для текста элементов форм «font: caption»
html> head> style> .primer3< font: caption; > /style> /head> body> div class css">primer3">Пример №3. Текст со свойством font: caption;/div> /body> /html>
На странице преобразуется в следующее
Для обращения к font из JavaScript нужно писать следующую конструкцию:
[window.]document.getElementById("elementID").style.font value">VALUE"
CSS font-family:Calibri;
This tutorial shows how to use CSS property font-family.
It sets the font-family to
This following style sheet shows how to use font-family to do «Shape Isoceles Trapezoid shape».
body< font-family: Calibri; background: #5F4014; > .container!-- w w w . d e m o 2 s . c o m--> position: relative; width: 90%; text-align: center; margin: 0px 5px; > .container:after< position: absolute; content: '\00a0'; width: 100%; left: 10px; top: 0px; padding: 10px; background: #4F0D00; box-shadow: inset 0px 0px 10px 2px #340800; border-top: 1px solid #715E49; -webkit-transform: perspective(25px) rotateX(-3deg); -moz-transform: perspective(25px) rotateX(-3deg); transform: perspective(25px) rotateX(-3deg); > a< position: relative; display: inline-block; color: white; text-decoration: none; width: 100px; text-align: center; padding: 10px; z-index: 2; > a:hover< color: gold; > a:active< color: #ff6767; >
body> div >"container"> a href="codpen.io">Link 1 a href="#">Link 2 a href="#">Link 3 a href="#">Link 4
html> head> style> body!-- w w w . d e m o 2 s . c o m--> font-family: Calibri; background: #5F4014; > .container< position: relative; width: 90%; text-align: center; margin: 0px 5px; > .container:after< position: absolute; content: '\00a0'; width: 100%; left: 10px; top: 0px; padding: 10px; background: #4F0D00; box-shadow: inset 0px 0px 10px 2px #340800; border-top: 1px solid #715E49; -webkit-transform: perspective(25px) rotateX(-3deg); -moz-transform: perspective(25px) rotateX(-3deg); transform: perspective(25px) rotateX(-3deg); > a< position: relative; display: inline-block; color: white; text-decoration: none; width: 100px; text-align: center; padding: 10px; z-index: 2; > a:hover< color: gold; > a:active< color: #ff6767; > body> div >'container'> a href='codpen.io'>Link 1 a href='#'>Link 2 a href='#'>Link 3 a href='#'>Link 4
Related
demo2s.com | Email: | Demo Source and Support. All rights reserved.