图片自适应
当设置的图片尺寸过大时,常常会显示异常,利用下面的这个方法,图片会自动使用当前界面显示100%的大小
css
img {
max-width: 100%;
height: auto;
}背景图片全屏
css
html{
height: 100%;
}
body{
background-image: url(img/wallpaper.png);
background-repeat:no-repeat;
background-size: 100% 100%;
}全局居中
css
body {
width: 700px;
margin: auto;
}让ul中的li元素横向排列
css
/*float:left和display:inline都可以实现ul li横向排列*/网页CSS常用字体
中文字体:
黑体:SimHei
宋体:SimSun
新宋体:NSimSun
仿宋:FangSong
楷体:KaiTi
仿宋_GB2312:FangSong_GB2312
楷体_GB2312:KaiTi_GB2312
微软雅黑体:Microsoft YaHei
英文字体:
PmingLiu
Impact
Georgia
Tahoma
Arial
Book Antiqua
Century Gothic
Courier New
Times New Roman
Verdana
margin 0 auto
margin后面如果只有两个参数的话,第一个表示top和bottom,第二个表示left和right
因为0 auto,表示上下边界为0,左右则根据宽度自适应相同值(即居中)
放大bootstrap每个col之间的间隔
css
[class*="col-"]{
padding: 50px;
}