Curs Html

Ca sa aliniati mai multe tag-uri <div> pe aceeasi linie in plan orizontal, puteti folosi aceste doua proprietati CSS: display: inline-block;, sau float (cu valoarea "left", sau "right").
- Pentru un design responsiv, ca elementele <div> sa ramana aliniate si ajustate la lungimea ferestrei browser-ului, folositi valori in procente (%) la lungimea DIV-urilor si margini.


Aliniere elemente Div cu inline-block

In urmatorul exemplu, elementele HTML <div> au proprietatea CSS: display: inline-block;

<!DOCTYPE html>
<html>
<head>
<title>Titlul</title>
<style>
#left, #center, #right {
 position: relative;
 display: inline-block;
 margin: 1em 0.1em 0.1em 0.8%;
 padding: 0.1em;
 background: #ebebfb;
 border: 2px solid blue;
}
#left {
 width: 22%;
 height: 11em;
}
#center {
 width: 52%;
 height: 14em;
}
#right {
 width: 16.2%;
 height: 11em;
}
</style>
</head>
<body>

<div id="left">
 <div>
 <a href="https://coursesweb.net/" title="Web Courses">CoursesWeb.net</a><br/>
 <a href="https://marplo.net/" title="MarPlo.net">MarPlo.net</a><br/>
 <a href="https://gamv.eu/" title="Flash Games">Flash Games</a><br/>
 </div>
</div>

<div id="center">
 <p>Content in the center Div.<br/>
 HTML Course and Tutorials - Align DIVs</p>
</div>

<div id="right">
 Content in the Div from right side.
</div>

</body>
</html>

Exemplu Aliniere cu float

Daca folositi proprietatea CSS float, adaugati un element HTML cu proprietatea "clear: both;" dupa ultimul DIV care are aplicat "float"; astfel aceasta nu va afecta celelalte elemente din pagina care sunt dupa DIV-urile aliniate.

<!DOCTYPE html>
<html>
<head>
<title>Titlul</title>
<style>
#left, #center, #right {
 position: relative;
 float: left;
 margin: 1em 0.1em 0.1em 0.8%;
 padding: 0.1em;
 background: #ebebfb;
 border: 2px solid blue;
}
#left {
 width: 22%;
 height: 11em;
}
#center {
 width: 52%;
 height: 14em;
}
#right {
 width: 16.2%;
 height: 11em;
}
.clr { clear: both; } /* to anulate the effect of the float */
#footer {
 position:relative;
 width: 99%;
 height: 5em;
 margin: 1em auto 0.2em auto;
 background: #befbbe;
}
</style>
</head>
<body>

<div id="left">
 <div>
 <a href="https://coursesweb.net/" title="Web Courses">CoursesWeb.net</a><br/>
 <a href="https://marplo.net/" title="MarPlo.net">MarPlo.net</a><br/>
 <a href="https://gamv.eu/" title="Flash Games">Flash Games</a><br/>
 </div>
</div>

<div id="center">
 <p>Content in the center Div.<br/>
 HTML Course and Tutorials - Align DIVs using float:left;</p>
</div>

<div id="right">
 Content in the right side Div.
</div>
<br class="clr" />

<div id="footer">
 Div under the DIVs aligned with "float: left", after the tag with "clear: both;".
</div>

</body>
</html>

Un Test simplu in fiecare zi

HTML
CSS
JavaScript
PHP-MySQL
Engleza
Spaniola
Ce tip de <input> creaza o paleta de culori pentru selectare culoare?
type="text" type="color" type="date"
<input type="color" name="get_color" />
Care metoda CSS roteste elementul HTML la un anumit numar de grade?
scale() translate() rotate()
#some_id:hover {
  transform: rotate(60deg);
  -ms-transform: rotate(60deg);    /* IE 9 */
  -moz-transform: rotate(60deg);   /* Firefox */
}
Click pe functia care returneaza numarul cel mai mare.
pow() min() max()
var maxn = Math.max(8, 4, 88, 56);
alert(maxn);      // 88
Ce functie previne ca un fisier sa fie inclus mai mult de o data intr-o pagina?
include() include_once() require()
include_once("un_fisier.php");
Care este traducerea corecta pentru: "Ahead of time"?
Peste timp La timp Inainte de vreme
Most people arrived ahead of time.
- Cei mai multi oameni au sosit inainte de vreme (prea devreme).
Indicati traducerea corecta a cuvantului "buenĂ­simo"
mai bun mai putin bun extrem de bun
Este fruto es buenĂ­simo.
- Acest fruct este extrem /nemaipomenit de bun.
Aliniere DIV-uri pe aceeasi linie

Last accessed pages

  1. Functii echivalente PHP is_ pentru testare tip date (172)
  2. Cursuri Limba Italiana (6849)
  3. Comparative neregulate (1602)
  4. Coduri pt culori (70529)
  5. Cursuri limba engleza gratuite si lectii online (65470)

Popular pages this month

  1. Cursuri si Tutoriale: Engleza, Spaniola, HTML, CSS, Php-Mysql, JavaScript, Ajax (442)
  2. Gramatica limbii engleze - Prezentare Generala (278)
  3. Coduri pt culori (242)
  4. Cursuri limba engleza gratuite si lectii online (186)
  5. Exercitii engleza - English Tests and exercises - Grammar (171)