The opacity property sets the opacity level for an element, opacity allows to change the transparency of an element.
IE8 and earlier supports an alternative variant, the filter property.

- Syntax:
filter: alpha(opacity=X);     /* for IE */
opacity: X;
- X - represents a value between 0 (completely transparent) and 1.0 (no transparency).

1) Example, a <div> with a css transparency of 40%:
<style type="text/css"><!--
#dv {
 background-color:blue;
 width:200px;
 height:100px;
 filter:alpha(opacity=40);     /* for IE */
 opacity:0.4;
}
--></style>

<div id="dv">Some content ...</div>
Demo:
Some content ...

2) Example, sets opacity of 50% on a image:
<style type="text/css"><!--
#im {
 filter:alpha(opacity=50);     /* for IE */
 opacity:0.5;
}
--></style>

<img src="html_course.jpg" alt="HTML and CSS Course" width="155" height="160" id="im" />
Demo:
HTML and CSS Course

3) Example, effect image transparency 50%, to 100% on the hover state:
<style type="text/css"><!--
#im2 {
 filter:alpha(opacity=50);     /* for IE */
 opacity:0.5;
}
#im2:hover {
 filter:alpha(opacity=100);     /* for IE */
 opacity:1;
}
--></style>

<img src="html_course.jpg" alt="HTML and CSS Course" width="155" height="160" id="im2" />
Demo (place the mouse over the image below):
HTML and CSS Course

4) DIV content that is covered with a transparent box on mouseover (the transparent box [a <div>] must be empty and set with   position:absolute;):
<style type="text/css"><!--
#trans {
 display:none;
 position:absolute;
 top:2%;
 left:2%;
 width:96%;
 height:95%;
 background-color:#07fe08;
 filter:alpha(opacity=50);     /* for IE */
 opacity:0.5;
}
#cnt {
 position:relative;
 background:#e7e8fe;
 width:300px;
 height:200px;
 border:1px solid blue;
 padding:20px;
}
#cnt:hover #trans { display:block; }
--></style>

<div id="cnt">
 <div id="trans"></div>
 Place the mouse over this box to see the opacity effect.
<img src="css3.jpg" alt="CSS3 opacity" width="160" height="98" />
</div>
Demo:
Place the mouse over this box to see the opacity effect. CSS3 opacity

Daily Test with Code Example

HTML
CSS
JavaScript
PHP-MySQL
Which tag renders as emphasized text, displaying the text oblique?
<strong> <pre> <em>
<p>Web development courses: <em>CoursesWeb.net</em></p>
Which CSS property defines the space between the element border and its content?
margin padding position
h3 {
  padding: 2px 0.2em;
}
Click on the method which returns the first element that matches a specified group of selectors.
getElementsByName() querySelector() querySelectorAll()
// gets first Div with class="cls", and shows its content
var elm = document.querySelector("div.cls");
alert(elm.innerHTML);
Indicate the PHP variable that contains data from a form sent with method="post".
$_SESSION $_GET $_POST
if(isset($_POST["field"])) {
  echo $_POST["field"];
}
CSS3 opacity

Last accessed pages

  1. Courses Web: PHP-MySQL JavaScript Ajax HTML CSS Flash-AS3 (43447)
  2. $_GET, $_POST and $_REQUEST Variables (19232)
  3. Integer and Float value in Select with PDO from string to numeric (2561)
  4. Conditional statements if, else, switch (823)
  5. Flash Games - Free online Games (4445)

Top accessed pages

  1. Courses Web: PHP-MySQL JavaScript Ajax HTML CSS Flash-AS3 (43447)
  2. PHP-MySQL free course, online tutorials PHP MySQL code (33041)
  3. Read Excel file data in PHP - PhpExcelReader (32967)
  4. Get Attribute (ID, Class, Name, Title, Src) with jQuery (29817)
  5. PHP PDO - exec (INSERT, UPDATE, DELETE) MySQL (27129)