ExampleSourceCode[]
- <divstyledivstyle="float:left;width:275px;height:375px;border:solidred;">
- <div
- style="height:375px;width:275px;position:relative;
- display:table-cell;vertical-align:middle;">
- <div
- style="position:static;position:absolute\9;top:50%;">
- <div
- style="position:relative;top:-50%;text-align:center;">
- <divstyledivstyle="width:275px;">
- <divstyledivstyle="width:160px;WORD-WRAP:break-Word;TABLE-LAYOUT:fixed;
- Word-break:break-all;text-align:left;">
- < span>div>
- < span>div>
- < span>div>
- < span>div>
- < span>div>
- < span>div>
8、垂直居中和使用margin水平居中
ExampleSourceCode[]
- <divstyledivstyle="float:left;width:275px;
- height:375px;border:solidred;">
- <div
- style="height:375px;width:275px;position:relative;
- display:table-cell;vertical-align:middle;">
- <div
- style="position:static;position:absolute\9;top:50%;">
- <div
- style="position:relative;top:-50%;">
- <divstyledivstyle="margin:0auto;width:160px;WORD-WRAP:break-Word;
- TABLE-LAYOUT:fixed;Word-break:break-all;">
- < span>div>
- < span>div>
- < span>div>
- < span>div>
- < span>div>