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 in <table> to create table header cell?
<thead> <th> <td>
<table><tr>
  <th>Title 1</th>
  <th>Title 2</th>
</tr></table>
Which CSS property sets the distance between lines?
line-height word-spacing margin
.some_class {
  line-height: 150%;
}
Which function opens a new browser window.
alert() confirm() open()
document.getElementById("id_button").onclick = function(){
  window.open("http://coursesweb.net/");
}
Indicate the PHP function that returns an array with names of the files and folders inside a directory.
mkdir() scandir() readdir()
$ar_dir = scandir("dir_name");
var_export($ar_dir);
CSS cursor property - Custom Cursors

Last accessed pages

  1. The Fifth Agreement (19036)
  2. Rectangle, Oval, Polygon - Star (3305)
  3. CSS3 - text-shadow, word-wrap, text-overflow (1315)
  4. Courses Web: PHP-MySQL JavaScript Node.js Ajax HTML CSS (141002)
  5. SHA1 Encrypt data in JavaScript (35526)

Popular pages this month

  1. Courses Web: PHP-MySQL JavaScript Node.js Ajax HTML CSS (577)
  2. Read Excel file data in PHP - PhpExcelReader (75)
  3. The Mastery of Love (68)
  4. CSS cursor property - Custom Cursors (58)
  5. The School for Gods (56)