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 attribute specifies the HTTP method (GET, POST) used to submit the form-data?
action method value
<form action="script.php" method="post"> ... </form>
Which CSS property allows to add shadow to boxes?
background-image box-shadow border-radius
#id {
  background-color: #bbfeda;
  box-shadow: 11px 11px 5px #7878da;
}
Which function removes the first element from an array?
pop() push() shift()
var fruits = ["apple", "apricot", "banana"];
fruits.shift();
alert(fruits.length);           // 2
Indicate the function that can be used to check if a PHP extension is instaled.
function() filetype() extension_loaded()
if(extension_loaded("PDO") === true) echo "PDO is available."
Center Fixed and Absolute element

Last accessed pages

  1. PHP Script Website Mini-Traffic (7281)
  2. innerHTML and outerHTML to Get and Replace HTML content (30658)
  3. Mysql SELECT JOIN tables on two different Databases (4523)
  4. Date and Time in ActionScript 3 (10112)
  5. CSS Trapezoid Shape (11425)

Popular pages this month

  1. Courses Web: PHP-MySQL JavaScript Node.js Ajax HTML CSS (120)
  2. CSS cursor property - Custom Cursors (13)
  3. PHP Unzipper - Extract Zip, Rar Archives (13)
  4. PHP-MySQL free course, online tutorials PHP MySQL code (12)
  5. JavaScript trim, rtrim and ltrim (11)