/* 导入Lato字体 */ @import url(http://fonts.googleapis.com/css?family=Lato:300,400,700); /* 定义codropsicons字体 */ @font-face { font-family: 'codropsicons'; src:url('../fonts/codropsicons/codropsicons.eot'); src:url('../fonts/codropsicons/codropsicons.eot?#iefix') format('embedded-opentype'), url('../fonts/codropsicons/codropsicons.woff') format('woff'), url('../fonts/codropsicons/codropsicons.ttf') format('truetype'), url('../fonts/codropsicons/codropsicons.svg#codropsicons') format('svg'); font-weight: normal; font-style: normal; } /* 设置所有元素的盒模型为border-box */ *, *:after, *:before { -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; } /* 设置body和html的默认样式 */ body, html { font-size: 100%; padding: 0; margin: 0; } /* Clearfix hack,用于清除浮动 */ .clearfix:before, .clearfix:after { content: " "; display: table; } .clearfix:after { clear: both; } /* 设置body的字体、颜色和背景色 */ body { font-family: 'Lato', Calibri, Arial, sans-serif; color: #fff; background: lightblue; } /* 主内容和头部容器的样式 */ .main, .container > header { margin: 0 auto; padding: 2em; } /* 头部容器的文本对齐和背景色 */ .container > header { text-align: center; background: lightblue; padding: 3em; } /* 头部标题的字体大小和行高 */ .container > header h1 { font-size: 2.625em; line-height: 1.3; margin: 0; font-weight: 300; } /* 头部副标题的样式 */ .container > header span { display: block; opacity: 0.7; padding: 0 0 0.6em 0.1em; } /* 主内容的宽度限制 */ .main { max-width: 69em; } /* 列的样式 */ .column { float: left; width: 50%; padding: 0 2em; min-height: 300px; position: relative; } /* 第二列的阴影效果 */ .column:nth-child(2) { box-shadow: -1px 0 0 rgba(0,0,0,0.1); } /* 列中段落的样式 */ .column p { font-weight: 300; font-size: 2em; padding: 0; margin: 0; text-align: right; line-height: 1.5; } /* 按钮的样式 */ button { border: none; padding: 0.6em 1.2em; background: deepskyblue; color: #fff; font-family: 'Lato', Calibri, Arial, sans-serif; font-size: 1em; letter-spacing: 1px; text-transform: uppercase; cursor: pointer; display: inline-block; margin: 3px 2px; border-radius: 2px; } /* 按钮悬停时的样式 */ button:hover { background: cornflowerblue; } /* 媒体查询:屏幕宽度小于等于46.0625em时 */ @media screen and (max-width: 46.0625em) { .column { width: 100%; /* 列宽变为100% */ min-width: auto; /* 最小宽度自动 */ min-height: auto; /* 最小高度自动 */ padding: 1em; /* 内边距增加 */ } .column p { text-align: left; /* 段落左对齐 */ font-size: 1.5em; /* 字体大小减小 */ } .column:nth-child(2) { box-shadow: 0 -1px 0 rgba(0,0,0,0.1); /* 阴影方向改变 */ } } /* 媒体查询:屏幕宽度小于等于25em时 */ @media screen and (max-width: 25em) { .codrops-icon span { display: none; /* 隐藏图标描述文字 */ } }