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 atribut face ca valoarea din caseta de text sa nu poata fi modificata de utilizator?
checked="checked" readonly="readonly" disabled="disabled"
<input type="text" value="valoare-fixa" readonly="readonly" name="a_name" />
Ce proprietate CSS permite crearea de colturi rotunjite?
background-size border-size border-radius
.class {
  border:2px solid blue;
  border-radius:1.2em;
}
Ce instructiune afiseaza o fereastra cu mesaj si butoane OK si Cancel?
indexOf() confirm() prompt()
var ques = window.confirm("Rezultatul lui 0+0 este 0?");
if (ques) alert("Corect");
else alert("Incorect");
Indicati functia PHP care returneaza numarul cel mai mic dintr-o multime de numere.
floor() ceil() min()
$min_nr = min(12, 8, 25, 13);
echo $min_nr;        // 8
Alegeti verbul corect care trebuie in propozitia: "Its ears ... big".
are is has
Its ears are big.
- Urechile lui sunt mari.
Alegeti verbul corect care trebuie in propozitia: "Los niños ... deportistas"
soy son está
Los niños son deportistas.
- Copii sunt sportivi.
Aliniere DIV-uri pe aceeasi linie

Last accessed pages

  1. Verbe modale - Modal verbs - CAN, COULD, MAY, MIGHT, MUST (68056)
  2. Coduri pt culori (74480)
  3. Clasificarea adverbelor - Adverbs classification (13608)
  4. Gramatica limbii engleze - Prezentare Generala (218514)
  5. Subtantive - Plural (6384)

Popular pages this month

  1. Cursuri si Tutoriale: Engleza, Spaniola, HTML, CSS, Php-Mysql, JavaScript, Ajax (42)
  2. Gramatica limbii spaniole. Indrumator si prezentare generala (42)
  3. Accentul si Pronuntia (21)
  4. Limba spaniola curs online incepatori si avansati (20)
  5. Gramatica limbii engleze - Prezentare Generala (20)