标签选择器:注意分号,重要!!!css
<style> h2 { color: blue; } </style>
类选择器:html
<style> .blue-text { color: blue; } </style>
style属性: 字体
经过外部连接或文件导入字体:spa
#导入Google Lobster字体 <link href="https://fonts.gdgdocs.org/css?family=Lobster" rel="stylesheet" type="text/css">
颜色: color 字号:font-size 字体:font-family code
字体自动降级:当字体lobster不可用时自动使用monospacehtm
<style> h2 { font-family: Lobster, Monospace; } </style>
添加图片:图片
<style> .smaller-image { width:100px; } </style> <img class="smaller-image" src="/images/relaxing-cat.jpg">
css边框 border属性:class
<style> .thin-red-border { border-color: red; //边框颜色 border-width: 5px; //边框宽度 border-style: solid; //边框样式 border-radius:10px; //边框圆角半径(也能够填写百分比,50%会呈现圆形边框) } </style>