1. 判斷分辨率,根據屏幕分辨率自動調用不同CSS的代碼。
如:
@media screen and (max-width: 1200px){
html,body{
margin: 0;
padding: 0;
width:1200px;
height: 100%;
}
footer{
width:1200px;
}
}
2.設定寬度值,並且使內容居中
在文字和圖片外圍設置一個具體的寬度,如1200px,並使內容居中(設置div爲margin:0 auto;)
1. 判斷分辨率,根據屏幕分辨率自動調用不同CSS的代碼。
如:
@media screen and (max-width: 1200px){
html,body{
margin: 0;
padding: 0;
width:1200px;
height: 100%;
}
footer{
width:1200px;
}
}
2.設定寬度值,並且使內容居中
在文字和圖片外圍設置一個具體的寬度,如1200px,並使內容居中(設置div爲margin:0 auto;)