css3的三种使用方法:1、内联样式,语法为“”;2、内部样式,语法为“元素{css样式代码;}”;3、外部样式,语法为“”。

本教程操作环境:windows10系统、CSS3&&HTML5版、Dell G3电脑。
css3的三种使用方法是什么
一、内联样式
内联样式通过style属性来设置,属性值可以任意的CSS样式。
html> <meta> <title>内联样式</title> <p> I love China!</p><div class="aritcle_card flexRow artxards"> <div class="artcardd flexRow"> <a class="aritcle_card_img" rel="nofollow" href="/xiazai/gongju/2905" title="CSS"><img src="https://img.php.cn/upload/manual/000/969/633/6af2b1226ad9e733.png" alt="CSS" onerror="this.onerror='';this.src='/static/lhimages/moren/morentu.png'" ></a> <div class="aritcle_card_info flexColumn"> <a rel="nofollow" href="/xiazai/gongju/2905" title="CSS" class="overflowclass">CSS</a> <p class="overflowclass">CSS 官方网站入口。访问 W3C 的 CSS 页面,查看 CSS 标准、学习资料与工作组动态;CSS 是 Web 标准,无需下载安装。</p> </div> <a rel="nofollow" href="/xiazai/gongju/2905" title="CSS" class="aritcle_card_btn flexRow flexcenter"><b></b><span>下载</span> </a> </div> </div>
显示效果:

二、内部样式
内部样式定义在文档的head部分,通过style标签来设置。需要使用元素选择器(p)来关联样式和要设置样式的标签(p标签)。
html>
<meta>
<title>内联样式</title>
<style>
p{
background: green;
}
</style>
<p> I love China!</p>
效果:

三、外部样式
在文档外的*.css定义css样式,然后在文档的head部分通过link元素引入。
html> <meta> <title>内联样式</title> <link> <p> I love China!</p>
style.css文件内容:
p{
background: yellow;
}
显示效果:

a.在一个外部样式表中导入其他样式表的样式
combine.css文件中导入上面的style.css
@import "style.css";
body{
background: red;
}
HTML文件中引入combine.css文件
html> <meta> <title>document</title> <link> <p> I <span>love</span> China!</p>
效果:

(学习视频分享:css视频教程)
前端入门到VUE实战笔记:立即使用
在学习笔记中,你将探索 前端 的入门与实战技巧!










