Vous êtes sur la page 1sur 2

No matter which box-sizing property value is used, any margin values will need

to be added to calculate the full size of the element.


Generally speaking, the best box-sizing value to use is border-box. The border-b
ox value makes our math much, much easier. If we want an element to be 400 pixel
s wide, it is, and it will remain 400 pixels wide no matter what padding or bord
er values we add to it.
he box model is one of the most confusing parts of learning how to write HTML an
d CSS. It is also one of the most powerful parts of HTML and CSS, and once we ha
ve it mastered, most everything else like positioning content will come to us fairly
easily.
n CSS the asterisk, *, is the universal selector, which selects every element. R
ather than listing every single element imaginable, we can use the asterisk as a
catch-all to select all elements for us.
There s an excerpt from a book called Art and Fear that s relevant here:
The ceramics teacher announced he was dividing his class into two groups. Al
l those on the left side of the studio would be graded solely on the quantity of
work they produced, all those on the right graded solely on its quality.
His procedure was simple: on the final day of class he would weigh the work
of the quantity group: 50 pounds of pots rated an A, 40 pounds a B, and so on. Tho
se being graded on quality , however, needed to produce only one pot - albeit a per
fect one - to get an A.
Well, come grading time and a curious fact emerged: the works of highest qua
lity were all produced by the group being graded for quantity!
It seems that while the quantity group was busily churning out piles of work and learning from their mistakes - the quality group had sat theorizing about per
fection, and in the end had little more to show for their efforts than grandiose
theories and a pile of dead clay.
Essentially, the float property allows us to take an element, remove it from the
normal flow of a page, and position it to the left or right of its parent eleme
nt.
All other elements on the page will then flow around the floated element. An <im
g> element floated to the side of a few paragraphs of text, for example, will al
low the paragraphs to wrap around the image as necessary.
For reference, when an element is floated, it will float all the way to the edge
of its parent element. If there isn t a parent element, the floated element will
then float all the way to the edge of the page.
When we float an element, we take it out of the normal flow of the HTML document
. This causes the width of that element to default to the width of the content w
ithin it.Additionally, to prevent floated elements from touching one another, ca
using the content of one to sit directly next to the content of the other, we ca
n use the margin property to create space between elements.
When floating an element, it is also important to recognize that an element is r
emoved from the normal flow of a page, and that may change an element s default di
splay value. The float property relies on an element having a display value of b
lock, and may alter an element s default display value if it is not already displa
yed as a block-level element.
For example, an element with a display value of inline, such as the <span> inlin
e-level element, ignores any height or width property values. However, should th
at inline-level element be floated, its display value will be changed to block,

and it may then accept height or width property values.


The position property identifies how an element is positioned on a page and whet
her or not it will appear within the normal flow of a document. This is used in
conjunction with the box offset properties top, right, bottom, and left which identi
fy exactly where an element will be positioned by moving elements in a number of
different directions.
By default every element has a position value of static, which means that it exi
sts in the normal flow of a document and it doesn t accept any box offset properti
es. The static value is most commonly overwritten with a relative or absolute va
lue, which we ll examine next.
By default every element has a position value of static, which means that it exi
sts in the normal flow of a document and it doesn t accept any box offset properti
es. The static value is most commonly overwritten with a relative or absolute va
lue, which we ll examine next.
Kada koristis float opciju onda mozes da dodatno pomeras objekat pomocu margina,
ako odlucis da pozicioniras pomocu relative,absolute onda ti margine ne rade vec
treba da koristis left,top ...
When we position the element using the box offset properties, the element overla
ps the element below it rather than moving that element down as the margin or pa
dding properties would.
absolutely positioned elements are moved in relation to their closest relativel
y positioned parent element. Should a relatively positioned parent element not e
xist, the absolutely positioned element will be positioned in relation to the <b
ody> element.
Apsolutno poziciranje nekog objekta vrsi se tako sto je potrebno da zeljeni obje
kat stavimo pod ,,position:absolute,, dok predak tog objekta mora da ima ,,posti
on:relative,, jer u suprotnom objekat ce se pomeriti u odnosu na neki drugi izvo
r ,uglavnom body.
The terms typeface and font are often interchanged, causing confusion. Here is a bre
akdown of exactly what each term means.
A typeface is what we see. It is the artistic impression of how text looks, feel
s, and reads.
A font is a file that contains a typeface. Using a font on a computer allows the
computer to access the typeface.
One way to help clarify the difference between a typeface and a font is to compa
re them to a song and an MP3. A typeface is very similar to a song in that it is
a work of art. It is created by an artist or artists and is open to public inte
rpretation. A font, on the other hand, is very similar to an MP3 in that it is n
ot the artistic impression itself, but only a method of delivering the artistic
value.

Vous aimerez peut-être aussi