温馨提示×

html怎么弄颜色块

小新
6070
2021-03-26 18:55:02
栏目: 编程语言

html弄颜色块的方法:1.创建一个html文件;2.在html文件中添加html代码架构。3.在body标签里面使用div标签创建三个块;4.在div标签中使用style属性添加背景颜色以及高度宽度实现颜色块;5.通过浏览器方式查看设置效果。

html怎么弄颜色块

html弄颜色块的方法:

1.首先创建一个html文件。

2.在html文件中添加html代码架构。

<!DOCTYPE html>

<html>

    <head>

        <title>颜色块</title>

    </head>

    <body>

    </body>

</html>

3.然后在html代码架构中的body标签里面使用div标签创建三个块。

<div>蓝色</div>

<div>红色</div>

<div>橙色</div>

4.在div标签中使用style属性添加背景颜色以及高度宽度实现颜色块。

<div style="background-color: blue; width:200px; height:200px;">蓝色</div>

<div style="background-color: red; width:200px; height:200px">红色</div>

<div style="background-color: orange; width:200px; height:200px">橙色</div>

5.最后可通过浏览器方式阅读html文件查看设置效果。

0