Outils pour utilisateurs

Outils du site


code_language:css

CSS

CSS = Cascading Style Sheets = Feuille de style en cascade. Fichier qui permet de paramétrer la mise en forme d'un fichier HTML.

Propriétés de mise en forme

Propriété Valeurs Description
font-family police1, police2, police3, serif, sans-serif, monospace Nom de police
@font-face Nom et source de la police Police personnalisée
font-size 1.3em , 16px, 120% Taille du texte
font-weight bold, normal Gras
font-style italic, oblique, normal Italique
text-decoration underline, overline, line-through, blink, none Soulignement, ligne au-dessus, barré ou clignotant
font-variant small-caps, normal Petites capitales
text-transform capitalize, lowercase, uupercase Capitales
font - Super propriété de police, bombine: font-weight, font-style, font-size, font-variant, font-family
text-align left, center, right, justify Alignement horizontal
vertical-align baseline, middle, sub, super, top, bottom Alignement vertical (cellules de tableau ou éléments inline-block uniquement
line-height 18px, 120%, normal Hauteur de ligne
text-indent 25px Alinéa
white-space pre, nowrap, normal Césure
word-wrap break-word, normal Césure forcée
text-shadow 5px 5px 2px blue (horizontale, verticale, fondu, couleur) ombre de texte

Propriété de couleur et de fond

Propriété Valeurs Description
color nom, rgb(rouge,vert,bleu), rgba(rouge,vert,bleau,transparence),#CF1A20 …) couleur du texte
background-color nom, rgb(rouge,vert,bleu), rgba(rouge,vert,bleau,transparence),#CF1A20 …) Couleur de fond
background-image url('image.png') Image de fond
background-attachment fixed, scroll Fond fixe
background-repeat repeat-x, repeat-y, no-repeat, repeat Répétition du fond
background-position (x y), top, center, bottom, left, right Position du fond
background - Super propriété du fond. Combine: background-image, background-repeat, background-attachment, background-position
opacity 0.5 Transparence

Propriétés des boîtes

Propriété Valeurs Description
width 150px,80% Largeur
height 150px,80% Hauteur
min-widht 150px,80% Largeur minimale
max-widht 150px,80% Largeur maximale
min-height 150px,80% Hauteur minimale
max-height 150px,80% Hauteur maximale
margin-top 23px Marge en haut (écart extérieur)
margin-left 23px Marge à gauche (écart extérieur)
margin-right 23px Marge à droite (écart extérieur)
margin-bottom 23px Marge en bas (écart extérieur)
margin 23px, 5px 23px 5px (haut, droite, bas, gauche Super-propriété de marge.
padding-left 23px Marge intérieur gauche
padding-right 23px Marge intérieur droite
padding-bottom 23px Marge intérieur bas
padding-top 23px Marge intérieur haut
padding 23px 5px 23px 5px (haut, droite, bas, gauche) Super-propriété de marge intérieure.
border-width 3px Epaisseur de bordure
border-color nom, rgb(rouge,vert,bleu), rgba(rouge,vert,bleu,transparence),#CF1A20… Couleur bordure
border-style solide, dotted, dashed, double, groove, ridghe, inset, outset Type de bordure
border 3px solid black Super propriété de bodure. On peut également utiliser border-top,border-right, border-bottom, border-left
border-radius 5px Bordure arrondie
box-shadow 6px 6px 0px black Ombre de boîte

Propriétés de positionnement et d'affichage

Propriété Valeurs Description
display block, inline, inline-block, table, table-cell, none… Type d'élément (block, inline, inline-block, none…)
visibility visible, hidden Visibilité
clip rect (0px, 60px, 30px, 0px) rect (haut, droite, bas, gauche) Affichage d'une partie d'élément
overflow auto, scroll, visible, hidden Comportement en cas de dépassement
float left, right, none Flottant
clear left, right, both, none Arrêt d'un flottant
position relative, absolute, static Positionnement
top 20px Position par rapport au haut
bottom 20px Position par rapport au bas
left 20px Position par rapport à la gauche
right 20px Position par rapport à la droite
z-index 10 Ordre d'affichage en cas de superposition. La plus grande valeur est affichée par dessus les autres.

Propriétés des listes

Propriété Valeurs Description
list-style-type disc, circle, square, decimal, lower-roman, upper-roman, lower,alpha, upper-alpha, none Type de liste
list-style-position inside, outside Position en retrait
list-style-image url('puce.png') Puce personnalisée
list-style - Super-propriété de liste. Combine: list-style-type, list-style-position, list-style-image

Propriétés des tableaux

Propriété Valeurs Description
border-collapse collapse, separate Fusion des bordures
empty-cells hide, show Affichage des cellules vides
caption-side bottom, top Position du titre du tableau

Autres Propriétés

Propriété Valeurs Description
cursor crosshair, default, help, move, pointer, progress, text, wait, e-resize, ne-resize, auto… Curseur de souris.

Exemple:

  1. /* Définition des polices personnalisées */
  2.  
  3. @font-face
  4. {
  5. font-family: 'BallparkWeiner';
  6. src: url('polices/ballpark.eot');
  7. src: url('polices/ballpark.eot?#iefix') format('embedded-opentype'),
  8. url('polices/ballpark.woff') format('woff'),
  9. url('polices/ballpark.ttf') format('truetype'),
  10. url('polices/ballpark.svg#BallparkWeiner') format('svg');
  11. font-weight: normal;
  12. font-style: normal;
  13. }
  14.  
  15. @font-face
  16. {
  17. font-family: 'Dayrom';
  18. src: url('polices/dayrom.eot');
  19. src: url('polices/dayrom.eot?#iefix') format('embedded-opentype'),
  20. url('polices/dayrom.woff') format('woff'),
  21. url('polices/dayrom.ttf') format('truetype'),
  22. url('polices/dayrom.svg#Dayrom') format('svg');
  23. font-weight: normal;
  24. font-style: normal;
  25. }
  26.  
  27. /* Eléments principaux de la page */
  28.  
  29. body
  30. {
  31. background: url('images/fond_jaune.png');
  32. font-family: 'Trebuchet MS', Arial, sans-serif;
  33. color: #181818;
  34. }
  35.  
  36. #bloc_page
  37. {
  38. width: 900px;
  39. margin: auto;
  40. }
  41.  
  42. section h1, footer h1, nav a
  43. {
  44. font-family: Dayrom, serif;
  45. font-weight: normal;
  46. text-transform: uppercase;
  47. }
  48.  
  49. /* Header */
  50.  
  51. header
  52. {
  53. background: url('images/separateur.png') repeat-x bottom;
  54. display: flex;
  55. justify-content: space-between;
  56. align-items: flex-end;
  57. }
  58.  
  59. #titre_principal
  60. {
  61. display: flex;
  62. flex-direction: column;
  63. }
  64.  
  65. #logo
  66. {
  67. display: flex;
  68. flex-direction: row;
  69. align-items: baseline;
  70. }
  71.  
  72. #logo img
  73. {
  74. width: 59px;
  75. height: 60px;
  76. }
  77.  
  78. header h1
  79. {
  80. font-family: 'BallparkWeiner', serif;
  81. font-size: 2.5em;
  82. font-weight: normal;
  83. margin: 0 0 0 10px;
  84. }
  85.  
  86. header h2
  87. {
  88. font-family: Dayrom, serif;
  89. font-size: 1.1em;
  90. margin-top: 0px;
  91. font-weight: normal;
  92. }
  93.  
  94. /* Navigation */
  95.  
  96. nav ul
  97. {
  98. list-style-type: none;
  99. display: flex;
  100. }
  101.  
  102. nav li
  103. {
  104. margin-right: 15px;
  105. }
  106.  
  107. nav a
  108. {
  109. font-size: 1.3em;
  110. color: #181818;
  111. padding-bottom: 3px;
  112. text-decoration: none;
  113. }
  114.  
  115. nav a:hover
  116. {
  117. color: #760001;
  118. border-bottom: 3px solid #760001;
  119. }
  120.  
  121. /* Bannière */
  122.  
  123. #banniere_image
  124. {
  125. margin-top: 15px;
  126. height: 200px;
  127. border-radius: 5px;
  128. background: url('images/sanfrancisco.jpg') no-repeat;
  129. position: relative;
  130. box-shadow: 0px 4px 4px #1c1a19;
  131. margin-bottom: 25px;
  132. }
  133.  
  134. #banniere_description
  135. {
  136. position: absolute;
  137. bottom: 0;
  138. border-radius: 0px 0px 5px 5px;
  139. width: 99.5%;
  140. height: 33px;
  141. padding-top: 15px;
  142. padding-left: 4px;
  143. background-color: rgba(24,24,24,0.8);
  144. color: white;
  145. font-size: 0.8em;
  146.  
  147. }
  148.  
  149. .bouton_rouge
  150. {
  151. height: 25px;
  152. position: absolute;
  153. right: 5px;
  154. bottom: 5px;
  155. background: url('images/fond_degraderouge.png') repeat-x;
  156. border: 1px solid #760001;
  157. border-radius: 5px;
  158. font-size: 1.2em;
  159. text-align: center;
  160. padding: 3px 8px 0px 8px;
  161. color: white;
  162. text-decoration: none;
  163. }
  164.  
  165. .bouton_rouge img
  166. {
  167. border: 0;
  168. }
  169.  
  170. /* Corps */
  171.  
  172. section
  173. {
  174. display: flex;
  175. margin-bottom: 20px;
  176. }
  177.  
  178. article, aside
  179. {
  180. text-align: justify;
  181. }
  182.  
  183. article
  184. {
  185. margin-right: 20px;
  186. flex: 3;
  187. }
  188.  
  189. .ico_categorie
  190. {
  191. vertical-align: middle;
  192. margin-right: 8px;
  193. }
  194.  
  195. article p
  196. {
  197. font-size: 0.8em;
  198. }
  199.  
  200. aside
  201. {
  202. flex: 1.2;
  203. position: relative;
  204. background-color: #706b64;
  205. box-shadow: 0px 2px 5px #1c1a19;
  206. border-radius: 5px;
  207. padding: 10px;
  208. color: white;
  209. font-size: 0.9em;
  210. }
  211.  
  212. #fleche_bulle
  213. {
  214. position: absolute;
  215. top: 100px;
  216. left: -12px;
  217. }
  218.  
  219. #photo_zozor
  220. {
  221. text-align: center;
  222. }
  223.  
  224. #photo_zozor img
  225. {
  226. border: 1px solid #181818;
  227. }
  228.  
  229. aside img
  230. {
  231. margin-right: 5px;
  232. }
  233.  
  234. /* Footer */
  235.  
  236. footer
  237. {
  238. display: flex;
  239. background: url('images/ico_top.png') no-repeat top center, url('images/separateur.png') repeat-x top, url('images/ombre.png') repeat-x top;
  240. padding-top: 25px;
  241. }
  242.  
  243. footer p, footer ul
  244. {
  245. font-size: 0.8em;
  246. }
  247.  
  248. footer h1
  249. {
  250. font-size: 1.1em;
  251. }
  252.  
  253.  
  254. #tweet
  255. {
  256. width: 28%;
  257. }
  258.  
  259. #mes_photos
  260. {
  261. width: 35%;
  262. }
  263.  
  264. #mes_amis
  265. {
  266. width: 31%;
  267. }
  268.  
  269. #mes_photos img
  270. {
  271. border: 1px solid #181818;
  272. margin-right: 2px;
  273. }
  274.  
  275. #listes_amis
  276. {
  277. display: flex;
  278. justify-content: space-between;
  279. margin-top: 0;
  280. }
  281.  
  282. #mes_amis ul
  283. {
  284. list-style-image: url('images/ico_liensexterne.png');
  285. padding-left: 2px;
  286. }
  287.  
  288. #mes_amis a
  289. {
  290. text-decoration: none;
  291. color: #760001;
  292. }
code_language/css.txt · Dernière modification: 2022/04/28 09:03 de 86.201.9.2