添加CSS的方法
方法一、在HTML里面添加CSS
在head 里面添加 style 标签
<head>
<title>CSS(2)</title>
<style>
h1{
color: red;
}
</style>
</head>
方法二、加载外部样式表CSS(link)
body{
font-family: 'Courier New', Courier, monospace;
}
<head>
<title>My page</title>
<link rel="stylesheet" href="style4.css">
</head>
CSS 基础元素及说明
body{
background: black;
/* 添加背景颜色 */
font-family: 'Courier New', Courier, monospace;
/* 更改字体样式 */
}
h2{
color: red;
/* 添加字体颜色(红色)*/
opacity: 0.5;
/* 添加透明度 */
}
button{
backgroud: gray;
border: none;
/* 无边框 */
border-radius: 5px;
/* 添加圆角边框 */
}