css.rst
author Oleksandr Gavenko <gavenkoa@gmail.com>
Sat, 22 Oct 2011 16:54:01 +0300
changeset 1045 d69b7a836498
child 1046 fed3bb94a948
permissions -rw-r--r--
CSS Browser support.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1045
d69b7a836498 CSS Browser support.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     1
.. -*- coding: utf-8; -*-
d69b7a836498 CSS Browser support.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     2
d69b7a836498 CSS Browser support.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     3
======
d69b7a836498 CSS Browser support.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     4
 CSS.
d69b7a836498 CSS Browser support.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     5
======
d69b7a836498 CSS Browser support.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     6
.. contents::
d69b7a836498 CSS Browser support.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     7
d69b7a836498 CSS Browser support.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     8
Adding CSS to HTML.
d69b7a836498 CSS Browser support.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     9
===================
d69b7a836498 CSS Browser support.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    10
d69b7a836498 CSS Browser support.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    11
Include in head tag::
d69b7a836498 CSS Browser support.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    12
d69b7a836498 CSS Browser support.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    13
  <html>
d69b7a836498 CSS Browser support.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    14
    <head>
d69b7a836498 CSS Browser support.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    15
      <link href="path-to.css" rel="stylesheet" type="text/css">
d69b7a836498 CSS Browser support.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    16
    </head>
d69b7a836498 CSS Browser support.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    17
    ...
d69b7a836498 CSS Browser support.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    18
  <html>
d69b7a836498 CSS Browser support.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    19
d69b7a836498 CSS Browser support.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    20
or::
d69b7a836498 CSS Browser support.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    21
d69b7a836498 CSS Browser support.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    22
  <head>
d69b7a836498 CSS Browser support.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    23
   <style type="text/css">
d69b7a836498 CSS Browser support.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    24
     h1 {border-width: 1; border: solid; text-align: center}
d69b7a836498 CSS Browser support.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    25
   </style>
d69b7a836498 CSS Browser support.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    26
  </head>
d69b7a836498 CSS Browser support.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    27
d69b7a836498 CSS Browser support.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    28
To change style in specific tag use::
d69b7a836498 CSS Browser support.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    29
d69b7a836498 CSS Browser support.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    30
  <b style="color: blue; font-family: ariel">Welcome!</b>
d69b7a836498 CSS Browser support.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    31
d69b7a836498 CSS Browser support.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    32
Selectors.
d69b7a836498 CSS Browser support.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    33
==========
d69b7a836498 CSS Browser support.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    34
d69b7a836498 CSS Browser support.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    35
  tag {}
d69b7a836498 CSS Browser support.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    36
  .class {}
d69b7a836498 CSS Browser support.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    37
  #id {} для id разрешены символы
d69b7a836498 CSS Browser support.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    38
  * {} - любой элемент
d69b7a836498 CSS Browser support.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    39
d69b7a836498 CSS Browser support.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    40
  tag tag1 {} - выбор tag1, у которых есть предок tag
d69b7a836498 CSS Browser support.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    41
  tag > tag {} - выбор дочернего элемента
d69b7a836498 CSS Browser support.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    42
  tag + tag {} - выбор соседних элементов
d69b7a836498 CSS Browser support.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    43
  tag ~ tag {} - выбор любого соседа
d69b7a836498 CSS Browser support.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    44
d69b7a836498 CSS Browser support.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    45
  [attr] {}
d69b7a836498 CSS Browser support.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    46
  [attr="..."] {}
d69b7a836498 CSS Browser support.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    47
  [attr~="..."] {} - присутствует слово ... в поле атрибута
d69b7a836498 CSS Browser support.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    48
  [attr*="..."] {} - присутствует набор символов ... в поле атрибута
d69b7a836498 CSS Browser support.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    49
  [attr^="..."] {} - начинается с ... в поле атрибута
d69b7a836498 CSS Browser support.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    50
  [attr$="..."] {} - заканчивается на ... в поле атрибута
d69b7a836498 CSS Browser support.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    51
  tag [attr|="..."] {}
d69b7a836498 CSS Browser support.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    52
d69b7a836498 CSS Browser support.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    53
  :link - не посещенные ссылки
d69b7a836498 CSS Browser support.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    54
  :visited - посещенные ссылки
d69b7a836498 CSS Browser support.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    55
  :active - нажатие на левую клавишу мыши на элементе
d69b7a836498 CSS Browser support.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    56
  :hover - назначать при наведении
d69b7a836498 CSS Browser support.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    57
  :focus - при фокусировке элемента
d69b7a836498 CSS Browser support.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    58
  :first-child - первый подэлемент
d69b7a836498 CSS Browser support.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    59
  :last-child - последний подэлемент
d69b7a836498 CSS Browser support.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    60
d69b7a836498 CSS Browser support.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    61
  :first-line
d69b7a836498 CSS Browser support.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    62
  :first-letter - выбрать первую букву (не приминимо к inline элементам)
d69b7a836498 CSS Browser support.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    63
  :before{content:"..."}, ставит перед контентом элементов строку xxx (можно
d69b7a836498 CSS Browser support.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    64
  использовать счетчики)
d69b7a836498 CSS Browser support.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    65
  :after{} - тоже, что и before, только ставит текст после контента тега
d69b7a836498 CSS Browser support.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    66
d69b7a836498 CSS Browser support.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    67
Emacs.
d69b7a836498 CSS Browser support.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    68
======
d69b7a836498 CSS Browser support.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    69
::
d69b7a836498 CSS Browser support.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    70
d69b7a836498 CSS Browser support.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    71
  $ sudo apt-get install css-mode
d69b7a836498 CSS Browser support.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    72
d69b7a836498 CSS Browser support.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    73
Graphical editor.
d69b7a836498 CSS Browser support.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    74
=================
d69b7a836498 CSS Browser support.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    75
::
d69b7a836498 CSS Browser support.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    76
d69b7a836498 CSS Browser support.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    77
  $ sudo apt-get install cssed
d69b7a836498 CSS Browser support.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    78
d69b7a836498 CSS Browser support.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    79
CSS Browser support.
d69b7a836498 CSS Browser support.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    80
====================
d69b7a836498 CSS Browser support.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    81
d69b7a836498 CSS Browser support.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    82
  http://www.css3.info/modules/selector-compat/
d69b7a836498 CSS Browser support.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    83
                Compatibility table: CSS3 Selectors.
d69b7a836498 CSS Browser support.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    84