Css Course

To can center a fixed or absolute positioned element (Div or other block element), set the right and left CSS properties to 0, and then margin-left and margin-right to auto, as if you were centering a static positioned element.
- Example, centering a fixed Div:
<style type="text/css">
#divid {
  position: fixed;
  /* center the element */
  right: 0;
  left: 0;
  margin-right: auto;
  margin-left: auto;
  /* give it dimensions */
  min-height: 8em;
  width: 90%;
  background: #dafeda;
}
</style>

<div id="divid">https://CoursesWeb.net/</div>
- Example, centering an absolute positioned Div (the parent element must have: position: relative):
<style type="text/css">
#parent{
 position:relative;
 height:8.5em;
}
#divid {
  position: absolute;
  /* center the element */
  right: 0;
  left: 0;
  margin-right: auto;
  margin-left: auto;
  /* give it dimensions */
  min-height: 8em;
  width: 90%;
  background: #dafeda;
}
</style>

<div id="parent">
  <div id="divid">https://marplo.net/jocuri</div>
</div>
Demo:
https://CoursesWeb.net/

Daily Test with Code Example

HTML
CSS
JavaScript
PHP-MySQL
Which tag adds a new line into a paragraph?
<b> <br> <p>
First line ...<br>
Other line...
Which CSS property can be used to add space between letters?
text-size word-spacing letter-spacing
#id {
  letter-spacing: 2px;
}
What JavaScript function can be used to get access to HTML element with a specified ID?
getElementById() getElementsByTagName() createElement()
var elm = document.getElementById("theID");
var content = elm.innerHTML;
alert(content);
Click on the "echo" correct instruction.
echo "CoursesWeb.net" echo "CoursesWeb.net"; echo ""CoursesWeb.net";
echo "Address URL: http://CoursesWeb.net";
Center Fixed and Absolute element

Last accessed pages

  1. Working with MySQL Database (3245)
  2. Detecting events in ActionScript 3 (1407)
  3. innerHTML in PHP (17116)
  4. JavaScript Course - Free lessons (31635)
  5. Creating Tabs Effect with JavaScript (953)

Popular pages this month

  1. Courses Web: PHP-MySQL JavaScript Node.js Ajax HTML CSS (515)
  2. CSS cursor property - Custom Cursors (86)
  3. The Mastery of Love (79)
  4. PHP-MySQL free course, online tutorials PHP MySQL code (65)
  5. CSS3 2D transforms (47)