Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ============================
- ======== CSS - TEXT - V.1
- ============================
- ============================
- ======== TEST CODE
- .style-brief-text>p {
- letter-spacing: 3px !important;
- overflow: hidden !important;
- overflow-y: auto !important;
- /* word-wrap: break-word !important;*/
- /* white-space: pre !important;*/
- /* white-space: pre-wrap !important;*/
- white-space: pre-line !important;
- /* -moz-hyphens: auto !important;*/
- /* text-indent: -150px !important;*/
- text-shadow: none !important;
- }
- ============================
- ========== TEXTE - PLACEHOLDER Text - ::placeholder - NEED VENDOR PREFIX ? (2010)
- == http://caniuse.com/#feat=css-placeholder
- ========== CSS pseudo-element
- To style it, you'll need vendor prefix CSS properties.
- ::-webkit-input-placeholder {
- color: red;
- }
- :-moz-placeholder { /* Firefox 18- */
- color: red;
- }
- ::-moz-placeholder { /* Firefox 19+ */
- color: red;
- }
- :-ms-input-placeholder {
- color: red;
- }
- ============================
- ========== TEXTE - text-align
- = https://css-tricks.com/almanac/properties/t/text-align/
- == https://css-tricks.com/almanac/properties/t/text-align/
- text-align:
- left - The default value. Content aligns along the left side.
- right - Content aligns along the right side.
- center - Content centers between the left and right edges. White space on the left and right sides of each line should be equal.
- justify - Content spaces out such that as many blocks fit onto one line as possible and the first word on that line is along the left edge and the last word is along the right edge.
- inherit - The value will be whatever the parent element's is.
- "Content" is used here as as term instead of "text", because while text-align certainly affects text, it affects all inline or inline-block elements in that container.
- There are two new values in CSS3
- start and end.
- These values make multiple language support easier
- For example
- English is a left-to-right (ltr) language
- Arabic is a left-to-right (rtl) language.
- Using "right" and "left" for values is too rigid and doesn't adapt as the direction changes. These new values do adapt:
- start - Same as "left" in ltr, same as "right" in rtl.
- end - Same as "right" in ltr, same as "left" in rtl.
- There is also match-parent, which is similar to inherit, only that the new value is calculated against the current element's direction instead of, you know, not doing that.
- There are a few things in the spec that don't have any browser support yet.
- One is the value "start end" which would align the first line as if was "start" and any subsequent lines as if it was "end".
- Another is giving the value a string, like text-align: "." start;
- The text will aline along the first occurrence of that <string>, as in to line up a column of numbers along a decimal point.
- Examples
- ============================
- ========== TEXTE - 13 PROPRIÉTÉS UTILISABLES POUR METTRE EN FORME LE TEXTE CONTENU DANS UNE BOÎTE.
- == http://cerig.efpg.inpg.fr/dossier/feuilles-de-style/page07.htm (tres bien)
- ========== FONT-FAMILY: Police
- -"serif" == Police avec empattements. cf :Nimes New Roman ;
- -"sans-serif" == Police sans empattements. cf: Arial ;
- -"monospace" Police non proportionnelle, occupe même largeur. cf: Courrier New ;
- -"cursive" Police imitant l'écriture cursive.
- -"fantasy" dPolice amusante
- ========== FONT-SIZE: Corps (taille) des caractères
- - valeur exprimée directement en pixels
- - pourcentage
- - "medium", "smaller" ou "larger"
- - "xx-small", "x-small" ou "small"
- - "xx-large", "x-large" ou "large"
- ========== FONT-STYLE: Texte normal ou en italique
- Texte est en italique ou non.
- La recommandation CSS prévoit également la valeur "oblique",
- mais cette dernière est implémentée comme la valeur italique par les navigateurs courants.
- Exemple :
- <p>Texte normal, <span style="font-style: italic">texte en italique</span>,
- <span style="font-style: oblique">texte en oblique</span></p>
- ========== FONT-WEIGHT: Graisse NORMAL BOLD > 900
- Définir la graisse des caractères.
- 9 valeurs sont prévues dans les recommandations CSS,
- numérotées de 100 à 900.
- Une telle subtilité peut se concevoir pour l'imprimé (si la police utilisée le prévoit),
- - normal (valeur "normal", par défaut) ;
- - caractères gras (valeur "bold"), équivalent de <b> en HTML ;
- - caractères très gras (valeur 900).
- En général, les valeurs supérieures à 600 sont toutes
- interprétées de la même façon (gras)
- Exemple :
- <p style="font-size: 14pt; font-family: Comic Sans MS">NORMAL,
- <span style="font-weight: bold">GRAS</span>,
- <span style="font-weight: 900">TRÈS GRAS ?</span></p>
- ========== FONT-VARIANT: Petites majuscules - small-caps
- Transformer les minuscules en petites majuscules (valeur "small-caps").
- Les majuscules ne sont pas modifiées.
- Exemple :
- <p>Petites Majuscules, <span style="font-variant: small-caps">Petites Majuscules</span></p>
- ========== FONT: Raccourci regroupant les cinq propriétés FONT plus LINE-HEIGHT
- 1 - Indication du style (STYLE, normal ou italique)
- 2 - graisse (WEIGHT)
- 3 - petites majuscules (VARIANT)
- Elles sont facultatives, et peuvent être écrites dans un ordre quelconque ;
- 4 - corps (la taille) des caractères (SIZE) doit obligatoirement être précisée ;
- 5 - nature de la police (FAMILY) doit obligatoirement être précisée, elle aussi.
- Exemple :
- <p style="font: italic small-caps bold 16pt Comic Sans MS">Texte d'essai</p>
- ========== TEXT-ALIGN Aligne le texte (à gauche, à droite, centré, justifié)
- - Texte à gauche ("left"). C'est la valeur par défaut ;
- - Texte à droite ("right") ;
- - Centrer le texte ("center") ;
- - Justifier le texte ("justify").
- Exemple :
- <p style="text-align: left; margin: 5px">Texte aligné à gauche</p>
- <p style="text-align: center; margin: 5px">Texte centré</p>
- <p style="text-align: right; margin: 5px">Texte aligné à droite</p>
- <p style="text-align: justify; margin: 5px">Texte justifié, assez long pour nécessiter un retour à la ligne</p>
- == Centrage d'éléments emboîtés.
- Précisons dès maintenant que tout se passe généralement bien si l'élément contenu est du type "en-ligne".
- C'est le cas du centrage d'une image, comme le montre l'exemple suivant :
- <p style="text-align: center"><img border="0" src="images/ns_logo_128_fwmx.gif" width="32" height="32"></p>
- ========== TEXT-DECORATION Texte souligné, surligné, barré
- - Souligner le texte ("underline") ;
- - Surligner le texte ("overline") ;
- - Barrer le texte ("line-through") ;
- - Clignoter le texte ("blink") DELETED
- Remarque : on peut à la fois souligner, surligner et barrer un texte:
- <p style="text-decoration: underline overline line-through">Texte souligné, surligné et barré simultanément</p>
- ========== TEXT-TRANSFORM Tout en majuscules, tout en minuscules, première lettre en majuscules
- - Ne pas modifier le texte ("none"). C'est la valeur par défaut ;
- - Commencer chaque mot par une majuscule ("capitalize") ;
- - Tout écrire en majuscules ("uppercase") ;
- - Tout écrire en minuscules ("lowercase").
- Exemple :
- <p>
- <span style="text-transform: none">Texte non modifié</span><br>
- <span style="text-transform: capitalize">une majuscule au début de chaque mot</span><br>
- <span style="text-transform: uppercase">texte en majuscules</span><br>
- <span style="text-transform: lowercase">TEXTE EN MINUSCULES</span>
- </p>
- ============================
- ======== TEXTE - CAPITALIZE (uppercase / lowercase) - CSS Text Transform
- <p style="text-transform:uppercase;">This text has been transformed to uppercase</p>
- <p style="text-transform:lowercase;">THIS TEXT HAS BEEN TRANSFORMED TO LOWERCASE</p>
- <p style="text-transform:capitalize;">this text has been capitalized.</p>
- This results in:
- This text has been transformed to uppercase
- THIS TEXT HAS BEEN TRANSFORMED TO LOWERCASE
- this text has been capitalized.
- text-transform css peut prendre les valeurs de :
- - capitalize, première lettre du texte en majuscule,
- - uppercase, texte en majuscule,
- - lowercase, texte en minuscule,
- - none, texte normal.
- - inherit hérite de son parent (css 2)
- ========== TEXT-INDENT Retrait de première ligne (positif ou négatif)
- Gérer le retrait de la première ligne d'un paragraphe.
- - Valeur négative implique le retrait du reste du paragraphe par rapport à la première ligne.
- Dans ce cas, il faut prévoir une marge interne gauche suffisante,
- sinon IE tronque le début de la première ligne,
- et Gecko le fait sortir de la boîte. Le retrait peut être exprimé en pixels ou en pourcentage.
- Exemple :
- <p style="text-indent: 0; text-align: justify">Ce paragraphe n'a pas de retrait de première ligne, la valeur de la propriété TEXT-INDENT est nulle.</p>
- <p style="text-indent: 15px; text-align: justify">Ce paragraphe possède un retrait de première ligne, la valeur de la propriété TEXT-INDENT est 15 pixels.</p>
- <p style="text-indent: -15px; text-align: justify; padding-left: 20px">Ce paragraphe possède un retrait négatif de première ligne, la valeur de la propriété TEXT-INDENT est -15 pixels.</p>
- Ce paragraphe n'a pas de retrait de première ligne, la valeur de la propriété TEXT-INDENT est nulle.
- (en arriere)Ce paragraphe possède un retrait de première ligne, la valeur de la propriété TEXT-INDENT est 15 pixels.
- (en avant) Ce paragraphe possède un retrait négatif de première ligne, la valeur de la propriété TEXT-INDENT est -15 pixels.
- ========== COLOR Couleur du texte
- ========== LINE-HEIGHT Interlignage
- Définir l'interlignage dans les boîtes de type BLOC.
- - Valeurs négatives ne sont pas prises en compte.
- - Valeur "normal" laisse le navigateur libre de faire au mieux ;
- c'est la valeur par défaut.
- L'interlignage peut être exprimé en pixels ou en pourcentage.
- Exemple :
- <p style="line-height: normal">Ce paragraphe possède un interlignage standard</p>
- <p style="line-height: 25px>Ce paragraphe possède un interlignage de 25 pixels</p>
- - Valeur de la propriété LINE-HEIGHT
- peut être introduite dans le raccourci FONT,
- en la regroupant avec celle relative au corps,
- et en séparant les deux valeurs par une barre oblique.
- Exemple :
- <p style="font: italic small-caps bold 12pt/25px Comic Sans MS">Texte doté d'un style regroupant six propriétés en un seul raccourci</p>
- ========== VERTICAL-ALIGN Indice et exposant
- Placer du texte :
- - en indice (une valeur ou "sub")
- - en exposant (une valeur ou "super").
- Elle est également utilisée en positionnement.
- Exemple :
- <p>Texte normal <span style="vertical-align: 4px; font-size: 70%">en exposant</span> normal</p>
- <p>Texte normal <span style="vertical-align: -3px; font-size :70%">en indice</span> normal</p>
- ========== LETTER-SPACING
- ==
- Spacing behavior between text characters.
- Syntax
- Formal syntax: normal | <length>
- letter-spacing: normal
- letter-spacing: 0.3em
- letter-spacing: 3px
- letter-spacing: .3px
- letter-spacing: inherit
- Values:
- normal
- The spacing is the normal spacing for the current font.
- This value allows the user agent to alter
- the space between characters in order to justify text.
- That's the difference to the length value 0.
- <length>
- Indicates inter-character space in addition
- to the default space between characters.
- Values may be negative, but there may be implementation-specific limits.
- User agents may not further increase or decrease the inter-character space in order to justify text.
- See <length> values for possible units.
- Examples:
- Having a css style of:
- p { letter-spacing: 0.4em }
- and a webpage with the code:
- <p> letter spacing </p>
- will produce the following:
- letter spacing
- Here are some more letter spacing examples:
- letter-spacing: 0.1em
- letter-spacing: 0.5em
- letter-spacing: 0.8em
- letter-spacing: 1em
- letter-spacing: -0.05em
- letter-spacing: 6px
- ============================
- ========== TEXT-ALIGN-LAST (flex box??)
- == https://developer.mozilla.org/en-US/docs/Web/CSS/text-align-last?redirectlocale=en-US&redirectslug=CSS%2Ftext-align-last
- How the last line of a block or a line, right before a forced line break, is aligned.
- Values :
- auto
- The affected line is aligned per the value of text-align,
- unless text-align is justify, in which case the effect is the same as setting text-align-last to left.
- start
- The same as left if direction is left-to-right and right if direction is right-to-left.
- end
- The same as right if direction is left-to-right and left if direction is right-to-left.
- left
- The inline contents are aligned to the left edge of the line box.
- right
- The inline contents are aligned to the right edge of the line box.
- center
- The inline contents are centered within the line box.
- justify
- The text is justified. Text should line up their left and right edges
- to the left and right content edges of the paragraph.
- Examples:
- div {
- text-align: justify;
- -moz-text-align-last: center;
- text-align-last: center;
- }
- text-align-last: auto
- text-align-last: start
- text-align-last: end
- text-align-last: left
- text-align-last: right
- text-align-last: center
- text-align-last: justify
- text-align-last: inherit
- ============================
- ========== Text-rendering : auto / optimizeSpeed / optimizeLegibility / geometricPrecision
- == http://htmlcss.wikia.com/wiki/HTML_%26_CSS_Wiki
- Provide information to the rendering engine about what sorts of tradeoffs to make when rendering text,
- in order to optimize speed or legibility.
- Currently only Gecko 1.9 (Firefox 3.0) and WebKit 532.5 (Safari 5 and Chrome 4) support this property.
- This property does not function on Mac OS X.
- This is an SVG property, it is not defined in any CSS standard.
- Gecko and WebKit apply text-rendering also to HTML and XML content.
- auto :
- The browser will make educated guesses about when to optimize for speed, legibility,
- and geometric precision while drawing text.
- In practice, Gecko desktop browsers like Firefox use optimizeLegibility if
- font size is 20px or larger. Otherwise optimizeSpeed for smaller text.
- optimizeSpeed:
- Gecko will emphasize rendering speed over legibility and geometric precision while drawing text.
- Disables kerning and ligatures.
- optimizeLegibility:
- Gecko will emphasize legibility over rendering speed and geometric precision.
- This enables kerning and optional ligatures.
- geometricPrecision:
- Gecko will emphasize geometric precision over rendering speed and
- legibility; this is currently the same as optimizeLegibility.
- One very visible effect is that optimizeLegibility enables ligatures (ff, fi, fl etc.)
- in text smaller than 20px for some fonts (e.g. Microsoft's Calibri, Candara, Constantia and Corbel or the DejaVu font family).
- CSS example:
- /* make sure all fonts in the HTML document display in all its glory,
- but avoid inadequate ligatures in class foo elements */
- body {
- text-rendering: optimizeLegibility;
- }
- .foo {
- text-rendering: optimizeSpeed;
- }
- ============================
- ======== Text-decoration: underline (looks better than text-decoration: underline)
- ==http://net.tutsplus.com/tutorials/html-css-techniques/the-30-css-selectors-you-must-memorize/
- border-bottom: 1px solid black;
- ============================
- ======== TEXTE - BLINK (REMOVED FOR FIREFOX > 23)
- text-decoration : valeur blink
- == TEXTE - BLINK : NEW SOLUTION: Imitating a blink tag with CSS3 animations
- == http://stackoverflow.com/questions/13955163/imitating-a-blink-tag-with-css3-animations
- == http://jsfiddle.net/es6e6/812/
- blink {
- display: inline;
- color: inherit;
- animation: blink 1s steps(1) infinite;
- -webkit-animation: blink 1s steps(1) infinite;
- }
- @keyframes blink { 50% { color: transparent; } }
- @-webkit-keyframes blink { 50% { color: transparent; } }
- == EXAMPLE @keyframe
- == GLOSS SHADOW
- body { font-family: Arial, Helvetica, "Liberation Sans", sans-serif; }
- #loader {
- background: #ddd;
- color: #333;
- border-radius: 4px;
- padding: 4px;
- display: inline-block;
- -webkit-box-shadow: 0 0 5px #333;
- box-shadow: 0 0 5px #333;
- -moz-animation-name: glow;
- -moz-animation-duration: .8s;
- -moz-animation-iteration-count: infinite;
- -moz-animation-timing-function: linear;
- -moz-animation-direction: alternate;
- -webkit-animation-name: glow;
- -webkit-animation-duration: .8s;
- -webkit-animation-iteration-count: infinite;
- -webkit-animation-timing-function: linear;
- -webkit-animation-direction: alternate;
- }
- @-moz-keyframes glow {
- from { box-shadow: 0 0 5px #333; }
- to { box-shadow: 0 0 10px #046; }
- }
- @-webkit-keyframes glow {
- from { -webkit-box-shadow: 0 0 5px #333; }
- to { -webkit-box-shadow: 0 0 10px #046; }
- }
- == EXAMPLE @keyframe
- == OPACITY HOVER
- @keyframes makando_fade {
- from { opacity: 0;}
- to {opacity: 1;}
- }
- #view-code {
- -moz-animation-name: makando_fade;
- -moz-animation-duration: 2s;
- -moz-animation-delay: 0.5s;
- -moz-animation-direction: reverse;
- -moz-animation-fill-mode: forwards;
- }
- #view-code:hover {
- opacity: 1 !important;
- }
- == SEE CCSS ANIMATION
- KEYFRAME INFO : you can't use !important in @keyframes rule.
- == https://developer.mozilla.org/en-US/docs/Web/CSS/@keyframes
- ============================
- ======== TEXTE - text-indent : Retrait de la première ligne d'un paragraphe
- ==http://css.mammouthland.net/blockquote-retraits-css.php
- Si on ne veut faire un retrait que sur la première ligne d'un paragraphe,
- c'est alors le text-indent qu'il faut utiliser.
- Code CSS
- .retrait {
- text-indent:50px;
- }
- ============================
- ======= font-feature-settings
- == https://css-tricks.com/almanac/properties/f/font-feature-settings/
- This property gives us control over advanced typographic settings such as small caps, ligatures, and swashes.
- To activate them you must declare which value you need in quotes and then followed by either 1 or on to enable.
- Alternatively, you can disable them with either 0 or off:
- .element {
- /* these two values do the same thing */
- font-feature-settings: "liga" 1;
- font-feature-settings: "liga1" on;
- }
- Many other values, besides standard ligatures are supported
- by the font-feature-settings property, including small caps:
- .element {
- font-feature-settings: "smcp" 1;
- }
- Values
- This is a list of every value that is supported by font-feature-settings,
- but make sure to check the web font that you’re using supports these values too before trying them:
- liga: standard ligatures
- dlig: discretionary ligatures
- onum: old style figures
- lnum: lining figures
- tnum: tabular figures
- zero: slashed zero
- frac: fractions
- sups: superscript
- subs: subscript
- smcp: small caps
- c2sc: small capitals from capitals
- case: case-sensitive forms
- hlig: historical ligatures
- calt: contextual alternates
- swsh: swashes
- hist: historical forms
- ss**: stylistic sets
- kern: kerning
- locl: localized forms
- rlig: required ligatures
- medi: medial forms
- init: initial forms
- isol: isolated forms
- fina: final forms
- mark: mark
- mkmk mark-to-mark positioning
- Combining multiple settings
- To add multiple features you need to follow one value by another in a comma separated list, like so:
- .element {
- font-feature-settings:"smcp" 1, "onum" 1;
- }
- Prefixes
- To get the best support across the browser spectrum, make sure to use these prefixes:
- .element {
- -moz-font-feature-settings:"smcp" 1;
- -ms-font-feature-settings:"smcp" 1;
- -o-font-feature-settings:"smcp" 1;
- -webkit-font-feature-settings:"smcp" 1;
- font-feature-settings:"smcp" 1;
- }
- ============================
- ======= Better web typography with OpenType features : -moz-font-feature-
- == http://opentype.info/blog/2010/08/14/better-web-typography-with-opentype-features/
- == REAL Small Caps
- == The CSS code is: -moz-font-feature-settings:’smcp=1′;
- == In this example we activate the proportional oldstyle figures by using
- -moz-font-feature-settings:’smcp=1,pnum=1,onum=1′;
- As you can see, even the dollar sign is changed to an appropriate small cap version.
- == Here is an example of discretionary ligatures activated by :
- -moz-font-feature-settings:’dlig=1′;
- == Contextual Alternates using :
- -moz-font-feature-settings:’calt=1′;
- == Case Feature applied those glyphs can be changed to match uppercase text:
- -moz-font-feature-settings:’case=1′;
- == Stylistic sets are defined as double-digit numbers between 01 and 20, for examle:
- -moz-font-feature-settings:’ss01=1′;
- == Fractions fraction like 1234/5678 and apply:
- -moz-font-feature-settings:’frac=1′;
- ============================
- ======== HIGHLIGHT TEXT - MARK <mark> </mark>
- ==== https://developer.mozilla.org/en-US/docs/Web/HTML/Element/mark
- == USERSTY FORUM : http://forum.userstyles.org/discussion/38932/userstyles-technology-upgrade-you-are-currently-testing-it-out#Item_219
- == PAGE WHERE IT IS USED:http://userstyles.org/styles/96399/about-blank-nyan-cat-firefox
- #long-description > MARK
- <mark>Please read the following text</mark>
- ============================
- ======== BLOCQUOTES (Simple and Nice Blockquote Styling) - 2013
- == http://css-tricks.com/snippets/css/simple-and-nice-blockquote-styling/
- == EXAMPLE :
- blockquote {
- background: #f9f9f9;
- border-left: 10px solid #ccc;
- margin: 1.5em 10px;
- padding: 0.5em 10px;
- quotes: "\201C""\201D""\2018""\2019";
- }
- blockquote:before {
- color: #ccc;
- content: open-quote;
- font-size: 4em;
- line-height: 0.1em;
- margin-right: 0.25em;
- vertical-align: -0.4em;
- }
- blockquote p {
- display: inline;
- }
- == TWEAK :
- blockquote {
- margin: 1.5em 0 1.5em;
- padding: 0 1em 0 2.5em;
- position:relative;
- }
- blockquote:before {
- color: #ccc;
- content: "\201C";
- font-size: 5em;
- position:absolute;
- left:5px;
- top: 0.3em;
- line-height: 0.1em;
- }
- blockquote:after {
- color: #ccc;
- content: "\201D";
- font-size: 5em;
- position:absolute;
- right:3px;
- bottom: 0em;
- line-height: 0.1em;
- }
- ============================
- ======== HIDE TEXT component of a SPRIT
- == http://css-tricks.com/video-screencasts/105-using-spritecow/
- No pseudo-elements required, so cross-browser support is stellar.
- The key elements are:
- - setting either the width or height of the block to 0
- - setting the padding to be the height or width of the sprite
- - hiding the text contents by setting overflow: hiddenI should mention
- — this only works on blocks.
- If you want to use this with an inline element (like an <a>),
- you’d have to set the display to inline-block or block.
- .sprite {
- background: url(sprite.png) no-repeat;
- width: 0;
- padding-left: 34px;
- overflow: hidden;
- }
- .sprite1 { background-position: -100px 0; }
- ============================
- ======== TEXTE - CS Une taille de police en fonction de la largeur d’écran
- == http://www.creativejuiz.fr/blog/veille-technologique/taille-police-en-fonction-largeur-ecran-viewport
- CSS3 à la rescousse
- Il existe une unité encore peu connue car prise en charge par nos navigateurs depuis peu de temps,
- il s’agit des unités relative au viewport. Pour comprendre ce qu’est le viewport,
- je vous invite à lire cette article de Raphaël Goetter : Comprendre le viewport dans le Web mobile.
- Pour résumer, nous allons proposer un corps de texte qui dépend de la largeur de la fenêtre du navigateur.
- Vous connaissez certainement les unités
- px, em, rem ou pt
- pour dimensionner vos corps de texte ?
- Rajoutez à cette liste :
- vw : « Viewport Width », correspond à l’unité relative à la largeur de votre écran
- vh : « Viewport Height », correspond à l’unité relative à la hauteur de votre écran
- vmin (vm pour IE9) : « Viewport Min », correspond à l’unité relative à la plus petite des deux dimensions (largeur ou hauteur selon l’orientation)
- vmax : « Viewport Max », correspond à l’unité relative à la plus grande des deux dimensions (largeur ou hauteur selon l’orientation)
- Très bien, mais que représente une unité de vw, par exemple ?
- C’est assez simple mais pas forcément intuitif de prime abord :
- 1 unité représente 1% de la dimension de référence.
- Prenons un exemple plus parlant.
- Si j’écris ce morceau de code CSS appliqué à mon titre de niveau 1 :
- h1 {
- font-size: 10vw;
- }
- Mon corps de texte aura un équivalent de 10% de la largeur de mon viewport,
- à savoir la largeur de la fenêtre de votre navigateur.
- Sur l’écran que j’utilise actuellement, la définition est de 1920px de large,
- mon titre de niveau 1 aura alors une font-size équivalente à 192px.
- ============================
- ======== TEXTE - CSS - UNITES CSS2
- == http://www.css-faciles.com/unites-css.php
- En pixels.
- Exemple : width:100px;
- Dans Explorer, les valeurs attribuées de cette façon sont fixes.
- Elles le resteront quelle que soient les variations de tailles des caractères et de la page.
- Dans les autres navigateurs, l'unité "px" varie avec la taille par défaut des polices.
- Contrairement au point (pt), la taille du pixel (px) est dépendante de la résolution et de la taille de l'écran.
- C'est donc une unité relative dépendante du périphérique affichant votre page.
- Lorsque vous définissez une valeur en px, vous devez utiliser un nombre entier.
- En "%".
- Exemple : width:50%;
- Les valeurs attribuées de cette façon permettent d'avoir une valeur proportionnelle
- à la taille de la fenêtre du navigateur
- ou à l'élément parent de celui pour lequel vous utilisez cette unité.
- Si vous utilisez des pourcentages dans une propriété liée à la taille des caractères,
- la valeur obtenue est proportionnelle à la taille de la police par défaut (1"em").
- Lorsque vous définissez une valeur en %, vous devez utiliser un nombre entier.
- En "em".
- Exemple : width:1.5em;
- Les valeurs attribuées de cette façon permettent d'avoir une valeur proportionnelle
- à la taille des caractères utilisés dans la page.
- 1em correspond à une hauteur de ligne de 1 caractère,
- soit 12pt si l'utilisateur n'a pas modifié la taille standard des caractères.
- Si l'utilisateur modifie la taille par défaut des caractères (avec CTRL + et CTRL -, par exemple),
- les valeurs définies en "em" varieront en conséquence.
- Cette unité est donc trés pratique pour modifier votre mise en page en fonction de la taille des caractères choisie par l'utilisateur.
- Vous pouvez utiliser des valeurs décimales du type "1.4em"
- Autres unités. La norme CSS2 a mis en place de nombreuses autres unités qui sont des variantes des 3 précédentes.
- Voici un récapitulatif complet des unités utilisables en CSS :
- em :
- Unité relative à la taille de police de l'élément.
- 1 em équivaut à 100% de cette taille.
- Seule exception à cette règle : lorsque la propriété font-size est définie,
- elle se rapporte à la taille de la police de l'élément parent.
- ex :
- Unité relative à la hauteur de la minuscule de l'élément.
- Seule exception à cette règle : lorsque la propriété font-size est définie,
- elle se rapporte à la hauteur de la minuscule de l'élément parent.
- px :
- Le pixel. Il s'agit d'une unité dont le rendu dépend de la résolution du périphérique d'affichage
- % :
- Le pourcentage est une unité relative à la taille de l'élément ou de son parent.
- ============================
- ======== TEXTE - CSS Text Decoration: Line Through (TXT BARRé par une ligne) and Overline (ligne au-dessus)
- == http://stanislav.it/css-text-decoration-line-through-and-overline/
- text-decoration: line-through;
- text-decoration: overline;
- ============================
- ======== TEXTE - PLACE HOLDER in a FORM , on input/textarea fields - ::-moz-placeholder
- == http://ftutorials.com/style-html5-placeholder/
- The HTML syntax for using placeholder is:
- <input type="tel" placeholder="Please enter your phone" name="phone" id="phone">
- how to change the color of the placeholders?
- Simply include the below code in your CSS.
- :-ms-input-placeholder { color: #ed7700; }
- ::-webkit-input-placeholder { color: #ed7700; }
- :-moz-placeholder { color: #ed7700; } /* Firefox 18 and under */
- ::-moz-placeholder { color: #ed7700; } /* Firefox 19+ */
- ============================
- ======== TEXTE - PLACE HOLDER - How To Remove , on input/textarea fields , The Placeholder On Focus [CSS Only]
- == http://stanislav.it/how-to-remove-the-placeholder-on-focus-css-only/
- on input/textarea fields
- input:focus::-webkit-input-placeholder { color: transparent; }
- input:focus:-moz-placeholder { color: transparent; } /* Firefox 18 and under */
- ============================
- ======== TEXTE - Text Overflow
- ==http://css3clickchart.com/?prop=text-overflow
- .element {
- white-space: nowrap;
- overflow: hidden;
- -o-text-overflow: ellipsis;
- -ms-text-overflow: ellipsis;
- text-overflow: ellipsis; /* or "clip" */
- }
- .element {
- height: 15px !important;
- text-overflow: ellipsis !important;
- white-space: nowrap !important;
- overflow: hidden !important;
- }
- ============================
- ======== CÉSURES (HYPHÉNATION) AVEC HYPHENS -moz-hyphens: auto;
- == http://www.alsacreations.com/tuto/lire/1038-gerer-debordement-contenu-css.html
- La propriétés hyphens n'est supportée que par quelques navigateurs actuellement
- (Firefox 6 ou 8 selon les langues, IE10, Safari 5.1)
- Elle va bien plus loin que word-wrap puisque la césure est "intelligente"
- (elle s’adapte aux règles typographiques de la langue employée) et affiche des traits d’union.
- Elle est donc bien pratique, mais encore assez peu supportée
- (elle nécessite d’ailleurs des préfixes vendeurs).
- Voici la propriété hyphens en application :
- .bloc {
- -webkit-hyphens: auto;
- -moz-hyphens: auto;
- -ms-hyphens: auto;
- -o-hyphens: auto;
- hyphens: auto;
- }
- ============================
- ======== HOW TO MAKE WORD-BREAK ON FIREFOX USING CSS
- == http://stackoverflow.com/questions/4282757/how-to-make-word-break-on-firefox-using-css/12235469#12235469
- /* For Firefox */
- white-space: pre-wrap;
- word-break: break-all;
- /* For Chrome and IE */
- word-wrap: break-word;
- ============================
- ======== PRE-WRAP - CODE CONTAINER (PRE) - RETOUR A LA LIGNE -
- === pre-wrap BETTER THAN pre-line
- == http://userscripts.org/scripts/review/104615
- /* USERSCRIPT CODE PAGE - MAIN CONTAINER - WIDTH + OVERFLOW -
- max-width: 1920px !important;
- === */
- .container {
- margin: 0 auto;
- max-width: 1920px !important;
- overflow: visible !important;
- }
- /* CONTENT CODE CONTAINER - WIDTH OVERFLOW - === */
- body.wide #content {
- overflow-x: auto;
- overflow-y: auto !important;
- width: 1870px !important;
- margin-left: -450px ! important;
- border: 1px solid red ! important;
- }
- /* CODE CONTAINER (PRE) - RETOUR A LA LIGNE -
- pre-wrap BETTER THAN pre-line
- === */
- /*pre {
- display: inline-block ! important;
- margin: 1.5em 0;
- white-space: pre-wrap !important;
- width: 81% !important;
- }*/
- #content pre {
- /* max-width: 100% ! important;*/
- /* max-width: 970px !important;*/
- overflow: hidden !important;
- text-overflow: ellipsis !important;
- white-space: pre-wrap !important;
- word-wrap: break-word !important;
- }
- ============================
- ======== <P> CAUSES A NEW PARAGRAPH.
- == http://http://forum.userstyles.org/discussion/35550/relaxing-paragraph
- But that wastes too much space in the pages I am battling.This will remove the block nature of p elements.
- p {display: inline !important;}
- Or if the p elements being used truly are empty, then you can try this to remove space wasting p's
- p:empty {
- display:none !important;
- }
- ============================
- ======== TEXT TRANSITION - COLOR (GRAY / ORANGE) - EXAPMLE
- == http://www.impressivewebs.com/articles/page/4/
- * {
- -moz-box-sizing: border-box;
- box-sizing: border-box;
- }
- .title-link:link, .title-link:visited {
- color: #4F5E67;
- text-decoration: none;
- }
- a, a:link, a:visited {
- transition: color 0.4s ease 0s;
- }
- .title-link, .entry-title {
- margin-bottom: 0.2em;
- }
- a {
- background: none repeat scroll 0 0 transparent;
- font-size: 100%;
- padding: 0;
- vertical-align: baseline;
- }
- .title-link:hover, .title-link:active, .title-link:focus {
- color: #E06C1F;
- }
- .title-link:link, .title-link:visited {
- text-decoration: none;
- }
- a, a:link, a:visited {
- transition: color 0.4s ease 0s;
- }
- a:hover, a:active {
- outline: 0 none;
- }
- .title-link, .entry-title {
- margin-bottom: 0.2em;
- }
- a {
- background: none repeat scroll 0 0 transparent;
- font-size: 100%;
- padding: 0;
- vertical-align: baseline;
- }
- ============================
- ======== EMBED LINE BREAKS INTO GENERATED CONTENT - #example:before { content: "Hello\A boy."; }
- == http://www.merttol.com/articles/code/introduction-to-css-escape-sequences.html
- The Unicode code point for the newline character is U+00000A.
- a CSS string, this can be written as \00000A.
- In a way similar to the way a hex triplet for color values can be shortened,
- escape sequences can also be shortened by dropping any leading zeros from the code point,
- so another way to write a newline is \A.
- Here’s a CSS rule that separates the two words “Hello” and “world”
- with a newline, placing each on their own line.
- #example:before { content: "Hello \A world."; }
- Something to be careful of when using escape sequences in CSS strings is ending
- the escape sequence where you intend to. Observe what happens if
- our “Hello world” text changed to “Hello boy.”
- #example:before { content: "Hello\Aboy."; }
- Now, instead of a newline (code point \A), our escape sequence
- is a left-pointing double angle quotation mark, or (code point \AB).
- Our generated content now reads “Hello«oy.” This happens because the “B” in “boy” is
- interpreted as a hexadecimal digit.
- The escape sequence terminates at the next character,
- the “O,” because that letter isn’t also such a digit.
- You can explicitly conclude an escape sequence in one of two ways.
- First, you can specify the sequence in full using all six hexadecimal digits
- (including leading zeros, if there are any). Second, you can append a space.
- The following two CSS rules are therefore equivalent:
- #example:before { content: "Hello\00000Aboy."; }
- #example:before { content: "Hello\A boy."; }
- Knowing this, we can now split our earlier image caption example across two lines just where we want to.
- Pay close attention to the addition of the white-space: pre; declaration.
- Since we’re generating whitespace characters and in most situations
- all whitespace in HTML gets collapsed to a single space,
- the white-space declaration is needed
- to interpret the newline literally
- (as though all the generated content were inside a <pre> element).
- img[title]:before {
- content: attr(title) "\AImage retrieved from"
- attr(src);
- white-space: pre;
- display: block;
- }
- === EXAMPLE PERSO : text avant et apres block
- == https://addons.mozilla.org/en-US/firefox/addon/identfavicon/
- #reviews .review .description:before {
- content: "Review :\00000A" ! important;
- white-space: pre ! important;
- color: red ! important;
- }
- #reviews .review .description:after {
- content: "\00000AReview End" ! important;
- white-space: pre ! important;
- color: peru ! important;
- }
- ============================
- ======== CSS TEXT-SHADOW in Safari, Opera, Firefox and more
- == http://maettig.com/code/css/text-shadow.html
- == http://kremalicious.com/make-cool-and-clever-text-effects-with-css-text-shadow/
- p { text-shadow: 1px 1px 1px #000; }
- The first two values specify the length of the shadow offset.
- The first value specifies the horizontal distance and
- the second specifies the vertical distance of the shadow.
- The third value specifies the blur radius and
- the last value describes the color of the shadow:
- 1. value = The X-ccordinate
- 2. value = The Y-coordinate
- 3. value = The blur radius
- 4. value = The color of the shadow
- Using positive numbers as the first two values ends up with placing the shadow
- to the right of the text horizontically (first value) and
- placing the shadow below the text vertically (second value).
- The third value, the blur radius, is an optional value
- which can be specified but don’t have to.
- It’s the amount of pixels the text is stretched which causes a blur effect.
- If you don’t use the third value it is threated as if you sepcified a blur radius of zero.
- - I’m a text with a smooth shadow :
- color: #000;
- background: #fff;
- text-shadow: 2px 2px 3px #000;
- - I’m a text with no smooth shadow :
- color: #000;
- background: #fff;
- text-shadow: 2px 2px #000;
- - I’m a text with a smooth shadow :
- color: #000;
- background: #fff;
- text-shadow: 2px -2px 3px #000;
- - I’m funky colored text :
- color: #33cc33;
- background: #fff;
- text-shadow: 2px 2px 2px #ff3300;
- - I’m engraved text :
- color: #000;
- background: #666;
- text-shadow: 0px 1px 1px #fff;
- - I’m engraved text on black :
- color: #666;
- background: #000;
- text-shadow: 0px 1px 0px #ccc;
- - I’m on top of the background :
- color: #fff;
- background: #666;
- text-shadow: 0px 1px 1px #000;
- - I’m subtle glowing text
- color: #fff;
- background: #000;
- text-shadow: 1px 1px 6px #fff;
- - I’m also glowing but more blurry :
- color: #fff;
- background: #666;
- text-shadow: 0px 0px 3px #fff;
- - I’m pretty mysterious looking text :
- color: #000;
- background: #000;
- text-shadow: 1px 1px 4px #fff;
- - I’m pretty milky looking text :
- color: #fff;
- background: #fff;
- text-shadow: 1px 1px 4px#000;
- - DUPLICATE shadow : Which line is text?
- color: #000;
- background: #fff;
- text-shadow: 0px 20px #000;
- - Multiple shadows :
- color: #000;
- background: #000;
- text-shadow: 0 0 4px #ccc, 0 -5px 4px #ff3, 2px -10px 6px #fd3, -2px -15px 11px #f80, 2px -18px 18px #f20;
- - Multiple Shadows :
- text-shadow: -1px -1px #666, 1px 1px #FFF;
- text-shadow: 1px 1px 3px #666, -1px -1px 3px #FFF, 1px 1px #666, -1px -1px #FFF;
- text-shadow: 0 -1px #000, 1px 0 #000, 0 1px #000, -1px 0 #000;
- text-shadow: 1px 0 #F33, -1px 0 #33F;
- text-shadow: 2px 0 4px #600, -2px 0 4px #006;
- text-shadow: 0 6px 4px #33F, -3px -5px 4px #F00, 3px -5px 4px #0F0;
- text-shadow: 0 0 24px #C00, 0 0 4px #C00, 1px 1px 2px #333;
- Classical Shadows :
- text-shadow: 1px 1px 2px #999;text-shadow: 2px 2px 3px #999;
- text-shadow: 0 0 8px #000;
- Glowing Borders
- text-shadow: 0 0 11px #0F0;text-shadow: 0 0 5px #FF0;
- text-shadow: 0 0 3px #F90;
- Unusual Effects :
- text-shadow: 0 7px 11px #390;
- text-shadow: 0px -15px 0 #F00;
- text-shadow: 0 0 11px #FF6;text-shadow: 0 0 8px #000;
- ============================
- ======== Flipping Text Upside Down
- == http://www.priteshgupta.com/2011/09/flip-or-reverse-text-using-css/
- -webkit-transform:rotate(-180deg);
- -moz-transform:rotate(-180deg);
- -o-transform:rotate(-180deg);
- transform:rotate(-180deg);
- ms-filter:"progid:DXImageTransform.Microsoft.BasicImage(rotation=2)";
- filter:progid:DXImageTransform.Microsoft.BasicImage(rotation=2);
- ============================
- ======== Reversing Text
- == http://www.priteshgupta.com/2011/09/flip-or-reverse-text-using-css/
- direction: rtl;
- unicode-bidi: bidi-override;
- ============================
- ======== TEXTE - TEXT JUSTIFIE - méthde de calcul (taille FONT x 30)
- == http://www.pompage.net/traduction/8-facons-simples-d-ameliorer-la-typographie-dans-vos
- Une manière simple pour calculer la justification est
- d'utiliser la méthode de Robert Bringhurst
- qui multiplie la taille de la police par 30.
- Si la taille de la police est de 10px, la multiplier par 30
- vous donne une justification de 300px ou
- environ 65 caractères par ligne.
- Le code ressemblerait à quelque chose comme :
- p {
- font-size: 10px;
- max-width: 300px;
- ============================
- ======== TEXTE - Escaped Unicode == Add a space (" ") after an element using :after
- ==http://stackoverflow.com/questions/5467605/add-a-space-after-an-element-using-after
- Needs to be specified via escaped unicode:
- h2:after {
- content: "\00a0"
- ============================
- ======== TEXTE - WHITE SPACE (iframe)
- ==http://www.yourhtmlsource.com/frames/inlineframes.html
- hspace="x"
- sets a margin of white space around the iframe to the sides.
- vspace="x"
- sets a margin of white space to the top and bottom of the iframe, pushing it away from other page elements.
- ============================
- ======== TEXTE - WORD WRAP - word-wrap: break-word;
- forcer le retour à la ligne d’un mot long
- et qui aura pour effet de couper le mot à un endroit
- arbitraire afin de provoquer un retour à la ligne.
- 2 valeurs :
- normal et break-word :
- word-wrap: break-word;
- ============================
- ======== CSS Ellipsis: How to Manage Multi-Line Ellipsis in Pure CSS
- == http://www.mobify.com/blog/multiline-ellipsis-in-pure-css/
- == JSFIDDLE live example == http://jsfiddle.net/microbians/csYjC/
- == JSFIDDLE live example (container take all the place avaible) ==
- I changed .ellipsis (height:200px) with :
- (position:absolute; top:0; bottom:0;)
- and .
- ellipsis:before (height:200px) with height:100%.
- It takes now the height of his container (for responsive work).
- It looks like it works : http://jsfiddle.net/UJY9A/
- Properly cutting off multi-line text is a surprisingly hard thing to do well.
- .overflow: hidden provides no indication of the text cut off.
- .text-overflow: ellipsis works only on single line content.
- .Various JavaScript solutions are fragile because
- they need explicit relayout whenever the box width or content changes.
- We can do better with pure CSS and a little imagination , use :
- BACKGROUND: -MOZ-LINEAR-GRADIENT
- AFTER
- BEFORE
- =====
- body {
- padding: 20px;
- }
- .box {
- position: relative;
- font-family: ans-serif;
- display: block;
- width: 344px;
- height: 8em;
- overflow: hidden;
- }
- .box .text {
- color: #333;
- padding: 20px;
- width: 304px;
- overflow: hidden;
- background: #E0E0E0;
- font-size: .95em;
- line-height: 1;
- text-align: justify;
- }
- .box .text:after {
- content: ' ';
- position: absolute;
- display: block;
- width: 100%;
- height: 1em;
- bottom: 0px;
- left: 0px;
- background: #E0E0E0;
- }
- .box .text:before {
- content: '...';
- text-align: right;
- position: absolute;
- display: block;
- width: 2em;
- height: 1em;
- bottom: em;
- right: 20px;
- background: -moz-linear-gradient(left, rgba(224,224,224,0) 0%, rgba(224,224,224,1) 38%, rgba(224,224,224,1) 99%);
- background: -webkit-gradient(linear, left top, right top, color-stop(0%,rgba(224,224,224,0)), color-stop(38%,rgba(224,224,224,1)), color-stop(99%,rgba(224,224,224,1)));
- background: -webkit-linear-gradient(left, rgba(224,224,224,0) 0%,rgba(224,224,224,1) 38%,rgba(224,224,224,1) 99%);
- background: -o-linear-gradient(left, rgba(224,224,224,0) 0%,rgba(224,224,224,1) 38%,rgba(224,224,224,1) 99%);
- background: -ms-linear-gradient(left, rgba(224,224,224,0) 0%,rgba(224,224,224,1) 38%,rgba(224,224,224,1) 99%);
- background: linear-gradient(to right, rgba(224,224,224,0) 0%,rgba(224,224,224,1) 38%,rgba(224,224,224,1) 99%);
- filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#00e0e0e0', endColorstr='#e0e0e0',GradientType=1 );
- }
- ============================
- ======== TEXTE - Ellipsis : text-overflow : règle overflow (hidden, scroll ou auto).
- ==http://www.alsacreations.com/tuto/lire/1038-gerer-debordement-contenu-css.html
- == http://www.w3.org/TR/css3-text/#overflow-wrap0
- Points de suspension avec text-overflow:
- La valeur ellipsis, des points de suspension (…) sont générés à l’endroit où le terme est rogné,
- Possible de substituer cet indice par un autre de son crû à l’aide de la propriété text-overflow-ellipsis.
- text-overflow: ellipsis !important;
- overflow: hidden !important;
- height: 15px !important;
- white-space: nowrap !important;
- ============================
- ======== TEXTE - Elipsis : text-overflow : règle overflow (hidden, scroll ou auto).
- ==http://www.alsacreations.com/tuto/lire/1038-gerer-debordement-contenu-css.html
- text-overflow:ellipsis !important;
- overflow: hidden !important;
- height: 15px !important;
- white-space: nowrap !important;
- overflow-x:hidden !important;
- overflow-y:scroll !important;
- ============================
- ======== TEXTE - WHITE SPACE - CSS White Space
- Tells the browser how to handle white space:
- Possible values:
- normal
- pre
- nowrap.
- <p style="white-space:pre;">This text has a line break
- and the white-space pre setting tells the browser to honor it
- just like the HTML pre tag.</p>
- This results in:
- This text has a line break and the white-space pre setting tells
- the browser to honor it just like the HTML pre tag.
- ============================
- ========== TEXTE - Centrer verticalement un texte dans un div
- == http://snipplr.com/view/31624/
- .vcenter span{
- line-height: 24px;
- /*ASTUCE : le span va se comporter comme une image, ainsi la propriété 'vertical-align' pourra agir sur lui*/
- display: inline-block;
- /*... on align le text verticalement au centre RMQ : pour un alignement en bottom
- il faudra modifier le line-height de l'element vcenter
- de maniére à ce qu'il soit plus ou moins le double d'une line-height actuel */
- vertical-align: middle;
- }
- .vcenter{
- margin: 0;
- line-height: 200px;
- }
- .conteneur{
- height: 200px;
- /*la configuration du conteneur avec une hauteur et overflow en hidden à son importance */
- si on ne veut pas voir les elements qui suivent étre poussé vers le bas
- overflow-y: hidden;
- width: 500px;
- border: 1px red solid;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement