i have a single page. it's made with html5
and css3
. in this page i have one div
. i want to align this div
. vertical align
and horizontal align
. for horizontal align
i use [ margin 0 auto
] but i don't know how i can vertical align
this div
.
i use the [ vertical-align: middle
] but didn't work.
i want to align body
for showing this div
in center vertical & horizontal.
my main question is : How to align body
for showing elements in center
?
*note : my page is full width and full height. like this
/*this is a body code*/
body {
width: 100%;
background: url(images/1.png);
direction: rtl;
text-align: center;
background-attachment: fixed;
background-repeat: round;
}
/*this is a div code*/
.indexcard {
width: 90%;
height: 500px;
margin: 0 auto;
}
/*this is a my cssreset code maybe you need this*/
html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
b, u, i, center,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td,
article, aside, canvas, details, embed,
figure, figcaption, footer, header, hgroup,
menu, nav, output, ruby, section, summary,
time, mark, audio, video {
margin: 0;
padding: 0;
border: 0;
font-size: 100%;
font: inherit;
vertical-align: baseline;
}