Advertisement
decembre

CSS - BEFORE-AFTER CONTENT v.1

May 8th, 2016
241
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 10.92 KB | None | 0 0
  1.  
  2.  
  3.  
  4. ============================
  5. ======== CSS - BEFORE-AFTER CONTENT v.1 - POSTé
  6. ============================
  7.  
  8. ============================
  9. ======== Using character escapes in markup and CSS
  10. == <a href="http://www.w3.org/International/questions/qa-escapes">Using character escapes in markup and CSS</a>
  11.  
  12. ============================
  13. ======== :BEFORE and :AFTER === A Whole Bunch of Amazing Stuff Pseudo Elements Can Do - June 13, 2011
  14. <a href="http://css-tricks.com/pseudo-element-roundup/">A Whole Bunch of Amazing Stuff Pseudo Elements Can Do</a>
  15.  
  16. - Expand the number of shapes you can make with a single element
  17. - Clear floats
  18. - Simulate float: center;
  19. - Label blocks of code with the language it is in
  20. - Create an entire icon set
  21. - Use available space more efficiently
  22. - Apply typographic flourishes
  23. - Create full browser width bars
  24. - Create a body border
  25. - Fade out a page when a particular link is rolled over
  26. - Style the numbers in ordered lists
  27. - Make data tables responsive
  28. - Create styled tooltips
  29.  
  30. ============================
  31. ======== BEFORE AFTER - QUOTE - Generated quotes
  32. ==http://www.javascriptkit.com/dhtmltutors/cssgenerate4.shtml
  33. Quotes can also be dynamically generated in CSS2 via the "quotes" property:
  34. P.myquotes{quotes: '"' '"';}
  35. Quotes are always specified in pairs, opening/closing quotation mark.
  36. In this case, I want the standard double quote (") in both cases,
  37. which is done by wrapping each double quote in single quote.
  38. Having done this, you now formally apply this quote behavior to an element:
  39. P.myquotes:before{
  40. content: open-quote;
  41. }
  42. P.myquotes:after{
  43. content: close-quote;
  44. }
  45. <p class="myquotes">Life is like a box of chocolates.</p>
  46. The result simply is (simulated): "Life is like a box of chocolates."
  47. ==4 values:
  48. open-quote: Inserts an opening quotation mark per the "quotes" property
  49. close-quote: Inserts a closing quotation mark per the "quotes" property
  50. no-open-quote: No opening quotation is inserted.
  51. no-close-quote: No closing quotation is inserted.
  52.  
  53. The "quotes" property is nifty in that it allows you to not only customize the type of quote to be shown.
  54. " (standard quotation) 0022
  55. ' (single quotation) 0027
  56. < (single left angle quotation) 2039
  57. > (single rght angle quotation) 203A
  58. « (double left angle quotation) 00AB
  59. » (double right angle quotation) 00BB
  60. ` (single left quotation) 2018
  61. ' (single right quotation) 2019
  62. `` (double left quotation/ curly) 201C
  63. '' (double right quotation/ curly) 201D
  64. ,, (double low-9 quotation) 201E
  65.  
  66. So for example, the below adds some bold curly quotes around the BLOCKQUOTE element:
  67. blockquote{quotes: "\201C" "\201D";}
  68. blockquote:before{content: open-quote; font-weight: bold;}
  69. blockquote:after{content: close-quote; font-weight: bold;}
  70.  
  71. <blockquote>
  72. What happens is not as important as how you react to what happens.
  73. </blockquote>
  74.  
  75. ============================
  76. =========== CSS3 Generated and Replaced Content Module 2003
  77. == http://www.w3.org/TR/css3-content/#reserved
  78. 4. Pseudo-elements
  79.  
  80. 4.1. Syntax
  81. 4.2. Inserting content into an element: the '::before' and '::after' pseudo-elements
  82. 4.2.1. Nesting '::before' and '::after' pseudo-elements
  83. 4.2.2. Inserting multiple '::before' and '::after' pseudo-elements
  84. 4.3. Wrapping elements in pseudo-elements with '::outside'
  85. 4.3.1. Mixing '::outside' with '::before' and '::after'
  86. 4.4. Inserting new content later in the document tree with '::alternate'
  87. 4.4.1. Mixing '::alternate' with '::outside', '::before', and '::after'
  88. 4.5. Block markers: The '::marker' pseudo-element
  89. 4.6. Line markers: The '::line-marker' pseudo-element
  90.  
  91. 5. Moving content to later in the document: the 'move-to' property
  92. 6. The 'display' property
  93. 7. Specifying quotes with the 'quotes' property
  94.  
  95. 7.1. Inserting quotes with the 'content' property
  96.  
  97. 8. Automatic counters and numbering: the 'counter-increment' and 'counter-reset' properties
  98.  
  99. 8.1. Nested counters and scope
  100. 8.2. Counter styles
  101. 8.3. Counters in elements with 'display: none'
  102. 8.4. Reserved Counter Names
  103.  
  104. . Named strings
  105. 10. '@counter' and '@string'
  106.  
  107. 10.1. '@counter'
  108. 10.2. '@string'
  109. 10.3. Determining which counter or string-set value to use: the 'page-policy' property
  110.  
  111. 11. Inserting and replacing content with the 'content' property
  112. 12. Replaced content
  113.  
  114. 12.1. The 'crop' property
  115. 12.2. Intrinsic dimensions
  116.  
  117. 13. Examples
  118.  
  119. 13.1. Footnote elements
  120. 13.2. Footnote attributes
  121. 13.3. Styling footnotes
  122. 13.4. Multiple styles on one element
  123. 13.5. Section notes
  124. 13.6. Top floats
  125.  
  126. ============================
  127. =========== BEFORE / AFTER
  128. ==FR : http://www.nanoum.net/blog/5_before_et_after.html
  129. ==http://www.css3create.com/after-before
  130. =========== CONTENT et BEFORE / AFTER
  131. edit:after /before CONTENT
  132. == http://forum.userstyles.org/discussion/27655/new-table-view/p1
  133.  
  134. .edit:after
  135. { content: "Edit" !important;
  136. font-size: 13px !important; }
  137.  
  138. .delete:before
  139. { content: "Delete" !important;
  140. font-size: 13px !important; }
  141.  
  142. .undelete:before
  143. { content: "Undelete" !important;
  144. font-size: 13px !important;
  145. color: #444 !important; }
  146.  
  147. ============================
  148. =========== CONTENT "- Remember this";
  149. == http://www.w3schools.com/cssref/sel_after.asp
  150. ==content:"- Remember this"
  151. ==content:url(images/light_bulb__exclamation.png)
  152. Insert content after every <p> element, and style the inserted content:
  153. p:after
  154. {
  155. content:"- Remember this";
  156. background-color:yellow;
  157. color:red;
  158. font-weight:bold;
  159. }
  160. ==EXEMPLE PERSO (Flickr) :
  161. FAIT avec cette page : http://www.flickr.com/photos/23329110@N08/5300550483/
  162. #gallery-count:after {
  163. content:"- Remember this";
  164. background-color:yellow;
  165. color:red;
  166. font-weight:bold;
  167. }
  168.  
  169. ============================
  170. =========== CONTENT:attr(href)
  171. == http://www.w3schools.com/cssref/pr_gen_content.asp
  172. == (test page Eyrolles) : http://www.editions-eyrolles.com/css2/tests/listes/listes4.htm
  173. The attr() property inserts a specified attribute's value before or after the selected element(s).
  174.  
  175. a:after
  176. {
  177. content: " (" attr(href) ")";
  178. }
  179.  
  180.  
  181. ============================
  182. =========== CONTENT : valeur
  183. == http://www.w3schools.com/cssref/pr_gen_content.asp
  184. == (test page Eyrolles) : http://www.editions-eyrolles.com/css2/tests/listes/listes4.htm
  185. Example :
  186. none - Sets the content, if specified, to nothing
  187. normal - Sets the content, if specified, to normal, which default is "none" (which is nothing)
  188. counter - Sets the content as a counter
  189. attr(attribute)- Sets the content as one of the selector's attribute
  190. string - Sets the content to the text you specify
  191. open-quote - Sets the content to be an opening quote
  192. close-quote - Sets the content to be a closing quote
  193. no-open-quote - Removes the opening quote from the content, if specified
  194. no-close-quote - Removes the closing quote from the content, if specified
  195. url(url) - Sets the content to be some kind of media (an image, a sound, a video, etc.)
  196. inherit - Specifies that the value of the content property should be inherited from the parent element
  197.  
  198. ============================
  199. =========== CONTENT :Astuce CUMULE DE REGLEs = [ ]
  200. On peut cumuler les indications à afficher.
  201. Ainsi, si on veut qu'à l'impression il y ait aussi l'indication de langue
  202. comme dans le précédent exemple (entre crochets et séparées d'un tiret), on indique :
  203. a:after {
  204. content: " (" attr(href) ") ";
  205. }
  206.  
  207. a:after {
  208. content: " [" attr(href) " - " attr(hreflang) "] ";
  209. }
  210. EXAMPLE PERSO - USERSTYLES FORUM COMMENTS :
  211. #vanilla_discussion_comment.Vanilla #Frame #Body #Content ul.DataList li.Item .Comment .Meta span.DateCreated a.Permalink:before, #vanilla_discussion_index.Vanilla #Frame #Body #Content ul.DataList li.Item .Comment .Meta span.DateCreated a.Permalink:before {
  212. color: #56B1E1 !important;
  213. content: " [" attr(name) " - " attr(class) "] " !important;
  214. display: inline-block !important;
  215. margin-right: 5px !important;
  216. width: auto !important;
  217. }
  218. /* TEST OK - - VIEWIER PAGE - ADD SITE NAME in BOOARD BOX - === */
  219. #pin_ajax_view .pin_container .left-column .big_pin_box .pin-header .navbar-inner .pull-left a.btn[target="_blank"]:after {
  220. position: relative !important;
  221. display: inline-block !important;
  222. width: auto !important;
  223. content:" ▶ " attr(data-hostname) " " !important;
  224. font-size: 10px !important;
  225. color:red !important;
  226. }
  227. /* OK - CONTENT COMBINED - CAM SHOW */
  228. .btnsLeft .userInfoFromTitle:after {
  229. position: absolute ! important;
  230. content: " ▶ "" camshow : " attr(uname)! important;
  231. height: 10px !important;
  232. line-height: 10px !important;
  233. width: auto !important;
  234. top: 70px ! important;
  235. left: -350px ! important;
  236. padding: 3px 10px !important;
  237. background-image: none !important;
  238. background: black ! important;
  239. font-size: 14px !important;
  240. color: gold !important;
  241. z-index: 500000 ! important;
  242. }
  243.  
  244. GOOD - EXAMPLE PERSO - S.COM :
  245. /* PROFILE - USER WEBSITE - ADD TXT - ( SITE ) - === */
  246. #global #container .user_info_box p a:after {
  247. position: absolute ! important;
  248. display: inline-block ! important;
  249. margin-left: 5px ! important;
  250. content: attr(href) ! important;
  251. content: "( " attr(href) " ) " ! important;
  252. }
  253. /* NOT GOOD - EXAMPLE PERSO (not working) - MOZ THEMES : https://addons.mozilla.org/en-US/firefox/themes/ - ==== */
  254. .persona-preview:before {
  255. position: relative !important;
  256. display: inline-block !important;
  257. content: "attr(name)" !important;
  258. /*content:" xxx" !important;*/
  259. color: gold !important;
  260. font-size: 10px !important;
  261. width: auto !important;
  262. }
  263.  
  264. ============================
  265. =========== CONTENT TRICK : Mark your visited links with checkmarks:
  266. ==http://css-tricks.com/css-content/
  267. #main-content a:visited:before {
  268. content: "\2713 ";
  269. }
  270.  
  271. ============================
  272. =========== CONTENT : Special Characters
  273. ==http://css-tricks.com/css-content/
  274. Here's some random useful ones:
  275.  
  276. \2018 - Left Single Smart Quote
  277. \2019 - Right Single Smart Quote
  278. \00A9 - Copyright
  279. \2713 - Checkmark
  280. \2192 - Right arrow
  281. \2190 - Left arrow
  282.  
  283.  
  284. ============================
  285. =========== CLEAR with :after
  286. ==http://net.tutsplus.com/tutorials/html-css-techniques/the-30-css-selectors-you-must-memorize/
  287. The before and after pseudo classes
  288. They simply generate content around the selected element.
  289. .clearfix:after {
  290. content: "";
  291. display: block;
  292. clear: both;
  293. visibility: hidden;
  294. font-size: 0;
  295. height: 0;
  296. }
  297.  
  298. .clearfix {
  299. *display: inline-block;
  300. _height: 1%;
  301. }
  302.  
  303. This hack uses the :after pseudo class to append a space after the element, and then clear it.
  304. It's an excellent trick to have in your tool bag, particularly in the cases when the overflow: hidden; method isn't possible.
  305.  
  306. For another creative use of this, refer to my quick tip on creating shadows.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement