css div水平垂直居中

< STYLE TYPE ="text/css" > ...
.middle-demo-4
{...}{
height
:400;
width
:100%;
position
:relative;

background
:#aaa;
}

.middle-demo-4div
{...}{
position
:absolute;
top
:50%;
left
:50%;
background
:blue
}

.middle-demo-4divdiv
{...}{
position
:relative;
top
:-50%;
left
:-50%;
background
:yellow;
overflow
:hidden;

}

</ STYLE >

< div class =middle-demo-4 >
< div >
< div > helpipsumdolorsitamet,consectetueradipiscingelit.asdsadfs. < br >< img src =1.jpg width =140 height =100 > asdsadfs. < br > asdsadfs.asdsadfs. < br > asdsadfs.asdsadfs. </ div >
</ div >
</ div >

你可能感兴趣的:(垂直居中)