Css Course

CSS content property is used to generate content in an element. It can only be used with the pseudo elements :after and :before.

.cnt_ex1:before {
 content: '~> ';
 color: #0000d0;

.cnt_ex1:after {
 content: ' <~';
 color: #0000d0;

<h4>Example CSS content</h4>

<div class='cnt_ex1'>CoursesWeb.net</div>
<div class='cnt_ex1'>MarPlo.net</div>
<div class='cnt_ex1'>GamV.eu</div>

The <style> element from these examples must be added in the <head> section of the page.

CSS content Values

Other examples with content property

Change list-item marker

- The following example displays this symbol ( » ) as list-item marker in <ul> elements with class of 'li_mark1':
ul.li_mark1 { list-style: none; }
ul.li_mark1 li:before {
 content: '\00BB'; /* Escaped Hex code notation */
 padding-right: 8px;

<h4>Example set list-item marker</h4>

<ul class='li_mark1'>
 <li>Free Courses and Tutorials</li>
 <li>HTML-CSS examples</li>
 <li>Today is a good day for 'Doing' Nothing</li>

New line in css content

To add a text in "content" property that contains new lines, add in string: \a for linebreak character, and white-space: pre;.
#cnt_ex4:after {
 content: '- Text from content \a Another line.';
 white-space: pre;

<h4>Example CSS content with lines of text</h4>

<div id='cnt_ex4'>HTML Div.</div>

Daily Test with Code Example

Which HTML5 tag is indicated to be used as container for menu with navigation links in Web site?
<section> <nav> <article>
 <li><a href="http://coursesweb.net/css/" title="CSS Course">CSS Course</a></li>
 <li><a href="http://www.marplo.net/jocuri/" title="Flash Games">Flash Games</a></li>
Which CSS property shifts an item horizontally to the left or right of where it was?
text-align clear float
.some_class {
  width: 30%;
  float: left;
Click on the Math object method which returns x, rounded downwards to the nearest integer.
Math.ceil(x) Math.abs(x) Math.floor(x)
var num = 12.34567;
num = Math.floor(num);
alert(num);       // 12
Indicate the PHP function which returns the number of characters in string.
mb_strlen() count() stristr()
$str = "string with utf-8 chars åèö";
$nrchr = mb_strlen($str);
echo $nrchr;        // 30
CSS Content

Last accessed pages

  1. SHA1 Encrypt data in JavaScript (20284)
  2. Dynamic variables in JavaScript (14443)
  3. Rectangle, Oval, Polygon - Star (2155)
  4. HTML Course - Free Lessons (19016)
  5. PHP Laravel Tutorials (1619)

Popular pages this month

  1. Courses Web: PHP-MySQL JavaScript Node.js Ajax HTML CSS (511)
  2. PHP-MySQL free course, online tutorials PHP MySQL code (270)
  3. JavaScript Course - Free lessons (258)
  4. CSS Course - Free lessons (236)
  5. HTML Course - Free Lessons (223)