Skip to content

Commit da9f511

Browse files
committed
added pseudo element example
1 parent 41166bb commit da9f511

File tree

1 file changed

+19
-3
lines changed

1 file changed

+19
-3
lines changed

css.html

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,11 @@
143143
-ms-filter:opacity(30%);
144144
-o-filter:opacity(30%);
145145
}
146+
#pseudoElementExample p:before{
147+
content: "Strating of Paragraph: ";
148+
font-weight: bolder;
149+
color: purple;
150+
}
146151
</style>
147152

148153
<!-- Just for debugging purposes. Don't actually copy this line! -->
@@ -389,7 +394,18 @@ <h2>13. pseudo class</h2>
389394
<p>pseudo classes is better if you dont want to mess up with javascript however, pesudo-classes is slow to process and apply rules.</p>
390395
<p>ref: <a href="http://coding.smashingmagazine.com/2011/03/30/how-to-use-css3-pseudo-classes/">How to use pseudo classes</a>, <a href="http://css-tricks.com/pseudo-class-selectors/">meet pseudo classes</a>, <a href="https://developer.mozilla.org/en-US/docs/Web/CSS/Pseudo-classes">list of pseudo classes</a></p>
391396
<h4>pseudo elements</h4>
392-
<p>pseudo elements helps you to add cosmetics contents. for example, you can add contents before/after of a content</p>
397+
<p>pseudo elements helps you to add cosmetics contents. pseudo elements generates content where as pseudo class deals with state of the element. for example, you can style <code>:first-letter</code> of every paragrpah. similarly, <code>:first-line</code> and fancy stuff with <code>:before</code>, <code>:after</code></p>
398+
<div>
399+
<button id = "pseudoElement" type="button" class="toggleExample btn btn-primary">show example</button>
400+
<div id="pseudoElementExample" class="hide">
401+
<pre><code>
402+
&lt;style&gt;<br/> p:before{<br/> content: &quot;Strating of Paragraph: &quot;;<br/> font-weight: bolder;<br/> color: purple;<br/> }<br/>&lt;/style&gt;<br/>&lt;p&gt;First Paragraph with some content.&lt;/p&gt;<br/>&lt;p&gt;Second Paragraph with something else.&lt;/p&gt;
403+
</code></pre>
404+
<strong>result:</strong>
405+
<p>First Paragraph with some content.</p>
406+
<p>Second Paragraph with something else.</p>
407+
</div>
408+
</div>
393409
<p>ref: <a href="http://nicolasgallagher.com/an-introduction-to-css-pseudo-element-hacks/">intro to css pseudo element</a>, <a href="http://coding.smashingmagazine.com/2011/07/13/learning-to-use-the-before-and-after-pseudo-elements-in-css/">:before :after</a>, <a href="http://css-tricks.com/css-content/">css content</a>, <a href="http://www.w3.org/TR/CSS21/generate.html">W3: generate content</a></p>
394410
</div>
395411
<div id="something">
@@ -399,8 +415,8 @@ <h2>14. text effect</h2>
399415
</div>
400416
<div id="filter">
401417
<h2>15. filter</h2>
402-
<p><strong>Question: What are the different css filter you can use?</strong></p>
403-
<p><strong>Answer: css filter allows u to render DOM element, image, or video. u can choose from: grayscale, blur, opacity, brightness, contrast.</strong></p>
418+
<p><strong>Question:</strong> What are the different css filter you can use?</p>
419+
<p><strong>Answer:</strong> css filter allows u to render DOM element, image, or video. u can choose from: grayscale, blur, opacity, brightness, contrast.</p>
404420
<div>
405421
<button id = "filter" type="button" class="toggleExample btn btn-primary">show example</button>
406422
<div id="filterExample" class="imageContainer hide">

0 commit comments

Comments
 (0)