Css Course


The cursor property can be used to change and control the appearance of the mouse cursor.
Syntax:

selector { cursor: value; }
- value - specifies the type of cursor to be displayed when pointing on an elemen.
In this table there are diferent types of values that you can use for cursor property (bellow you can see some code examples):

CSS Cursors
Example, three DIVs with diferent cursor type for each one.
<style>
#ex1 div {
 display: inline-block;
 width: 28%;
 height: 75px;
 margin: 2px 1%;
 background: #d0d0fe;
 text-align: center;
}
#idiv1 { cursor: pointer; }
#idiv2 { cursor: wait; }
#idiv3 { cursor: move; }
</style>

<h4>Example CSS cursor property</h4>
<p>Move the mouse over each cell.</p>

<div id='ex1'>
 <div id='idiv1'>Value - pointer</div>
 <div id='idiv2'>Value - wait</div>
 <div id='idiv3'>Value - move</div>
 <br style='clear:left;' />
</div>

Cursor Images

If you want a custom cursor, you can use an image for the mouse cursor appearance. The standard image type that can be used for cursor is the .cur format.
To create a .cur file, you need specialized imagery software. A freely available cursor editor is the JustCursors, you can use this software to edit /create static or animated cursors. To download it, click: Download JustCursors.
Once you have the '.cur' file, use this syntax in your style sheet:
selector { cursor: url('image.cur'), default; }

Example:
<style>
#ex2 {
 height: 100px;
 background: #fefeae;
 cursor: url('css/bluearrow.cur'), default;
}
</style>

<h4>Example image cursor</h4>
<p>Place your mouse over the text bellow.</p>

<div id='ex2'>Cursor Image, '.cur'</div>

Modern browsers, like Mozilla Firefox, Google Chrome, can use PNG images for cursor.


- Another example, cursor with PNG image (a cursor rose):
<style>
#ex3 {
 height: 100px;
 background: #fefeae;
 cursor: url('css/rosecursor.png'), default;
}
</style>

<h4>Example PNG image cursor</h4>
<p>Place your mouse over the text bellow.</p>

<div id='ex3'>Cursor Images, '.png' (for modern browsers).</div>

Click: Cursor Images to download an archive with some '.cur' and '.ani' files that you can use to test the examples presented in this tutorial.


Path to the image file

If you add the CSS code into an external '.css' file, take into account the fact that modern browsers (Mozilla Firefox, Google Chrome) interpret relative URLs as relative to the '.css' file. So, in the code in '.css' add the 'url' paths for '.cur' file, relative to that '.css' file.
/*
 The CUR and CSS files are in the same folder, the HTML is in a directory above this CSS file
*/

#id {
 cursor: url('bluearrow.cur'), default;
}

Daily Test with Code Example

HTML
CSS
JavaScript
PHP-MySQL
Which tag is used to add lists into <ul> and <ol> elements?
<dt> <dd> <li>
<ul>
 <li>http://coursesweb.net/html/</li>
 <li>http://coursesweb.net/css/</li>
</ul>
Which value of the "display" property creates a block box for the content and ads a bullet marker?
block list-item inline-block
.some_class {
  display: list-item;
}
Which instruction converts a JavaScript object into a JSON string.
JSON.parse() JSON.stringify eval()
var obj = {
 "courses": ["php", "javascript", "ajax"]
};
var jsonstr = JSON.stringify(obj);
alert(jsonstr);    // {"courses":["php","javascript","ajax"]}
Indicate the PHP class used to work with HTML and XML content in PHP.
stdClass PDO DOMDocument
$strhtml = '<body><div id="dv1">CoursesWeb.net</div></body>';
$dochtml = new DOMDocument();
$dochtml->loadHTML($strhtml);
$elm = $dochtml->getElementById("dv1");
echo $elm->nodeValue;    // CoursesWeb.net
CSS cursor property - Custom Cursors

Last accessed pages

  1. Mysql SELECT JOIN tables on two different Databases (4498)
  2. jQuery UI draggable - Drag elements (11448)
  3. Courses Web: PHP-MySQL JavaScript Node.js Ajax HTML CSS (142520)
  4. Using the Bone Tool (4253)
  5. Node.js Move and Copy Directory (20134)

Popular pages this month

  1. Courses Web: PHP-MySQL JavaScript Node.js Ajax HTML CSS (523)
  2. The Mastery of Love (65)
  3. CSS cursor property - Custom Cursors (62)
  4. Read Excel file data in PHP - PhpExcelReader (59)
  5. PHP-MySQL free course, online tutorials PHP MySQL code (44)