position
property (examples)
div#rightside {
position: fixed;
right: 10%;
top: 36%;
}
top
, bottom
, left
, right
valueswidth
property as wellz-index
propertyz-index
winsauto
(default) or a numberobject.style.zIndex = "value";
left
, right
, top
, or bottom
value can be negative to create an element that sits outside the visible browser windowwidth
, height
, min-width
, etc.) are ignored for inline boxesmargin-top
and margin-bottom
are ignored, but margin-left
and margin-right
are nottext-align
property controls horizontal position of inline boxes within it
vertical-align
property aligns it vertically within its block box
vertical-align
propertytop
, middle
, bottom
, baseline
(default), sub
, super
, text-top
, text-bottom
, or a length value or %
baseline
means aligned with bottom of non-hanging lettersobject.style.verticalAlign = "value";
vertical-align
example<p style="background-color: yellow;"> <span style="vertical-align: top; border: 1px solid red;"> Don't be sad! Turn that frown <img src="sad.jpg" alt="sad" /> upside down! <img style="vertical-align: bottom" src="smiley.jpg" alt="smile" /> Smiling burns calories, you know. <img style="vertical-align: middle" src="puppy.jpg" alt="puppy" /> Anyway, look at this cute puppy; isn't he adorable! So cheer up, and have a nice day. The End. </span></p>
Don't be sad! Turn that frown
upside down!
Smiling burns calories, you know.
Anyway, look at this cute puppy; isn't he adorable! So cheer up, and have a nice day. The End.
<p style="background-color: red; padding: 0px; margin: 0px"> <img src="images/smiley.png" alt="smile" /> </p>
padding
and margin
of 0vertical-align
to bottom
fixes the problem (so does setting line-height
to 0px
)display
property
h2 { display: inline; background-color: yellow; }
none
, inline
, block
, run-in
, compact
, ...