网站开发简介
HTML简介HTML是超文本标记语言(HyperText Markup Language),是一种用于创建网页的标准标记语言,HTML由一个个标签组成,文件的后缀名是html或htm,一个html文件就是一个网页,html文件用编辑器打开就显示文本,用浏览器打开就会渲染成网页。 HTML基本结构:
<!DOCTYPE html><html><head> <title>黑猫编程</title></head><body> 网页显示内容</body></html> 前端开发需要哪些技术?
前端开发编辑器前端开发语言本质上都是文本文件,只要后缀名符合标准,任何文本编辑器都可以用来写前端代码,在此推荐几种编辑器: IDE——集成开发环境:
轻量级文本编辑器:
VS Code开发前端项目比较方便,推荐安装插件:
![]() 标签分类分类一:
分类二:
<meta>标签所有浏览器都支持 <meta> 标签: ![]()
图像标签<img>标签可以在网页上插入一张图片,它是独立使用的标签,它的常用属性有:
标题标签通过<h1>、<h2>、<h3>、<h4>、<h5>、<h6>,标签可以在网页上定义6种级别的标题。6种级别的标题表示文档的6级目录层级关系,比如说: <h1>用作主标题,其后是<h2>,再其次是 <h3>,以此类推。搜索引擎会使用标题将网页的结构和内容编制索引。
span和div
思考:完成如下图所示效果
![]() <!--添加两个div进行嵌套--><div style='width: 100px; height: 100px; background-color: pink'> <div style='width: 50px; height: 50px; background-color: yellow'></div></div> ![]() CSS样式css:Cascading Style Sheet 层叠样式表,它是用来美化页面的一种语言。
![]()
![]() CSS引入三种方式
<style> div { background-color:yellow; color:green; }</style>
常用CSS选择器css 选择器是用来选择标签的,选出来以后给标签加样式
.a { font-weight:bold; color:yellow;}
#info { font-size:24px; color:red;}
nth-child: nth-child(odd) nth-child(even) nth-child(3n+1) nth-child(3) nth-last-child(3) nth-child(-n+3) nth-child(n+5) last-child first-child 伪元素
.father::after{ display: block; content: '最后面'; width: 100px; height:100px; background-color: yellow;} 超链接
a:link{ text-decoration: none;}a:visited{ color: red;}a:hover{ color: orange;}a:active{ color: green;} 锚点定位通过创建锚点链接,用户能够快速定位到目标内容。创建锚点链接分为两步: ![]() 文本标签注释标签:如果需要在HTML文档中添加一些便于阅读和理解但又不需要显示在页面中的注释文字,就需要使用注释标签。 简单解释:注释内容不会显示在浏览器窗口中,但是作为HTML文档内容的一部分,也会被下载到用户的计算机上,查看源代码时就可以看到。 <!-- 注释语句 --> 文本属性
![]() ![]() ![]() 特殊字符 ![]() 背景属性背景颜色: background-color:颜色值; 默认的值是 transparent 透明的 background: rgba(0, 0, 0, 0.3); 最后一个参数为透明度背景平铺:pbackground-repeat : repeat | no-repeat | repeat-x | repeat-y背景固定:pbackground-attachment : scroll | fixed背景位置: background-position : x y: x和y:为长度值或top、left等方位词background-size:contain/cover 盒子模型![]() ![]()
浮动应用,首页布局![]() <!DOCTYPE html><html lang='en'><head> <meta charset='UTF-8'> <meta http-equiv='X-UA-Compatible' content='IE=edge'> <meta name='viewport' content='width=device-width, initial-scale=1.0'> <title>Document</title> <style> .container{ width: 700px; border: 1px solid gray; margin: 0 auto; background-color: lightyellow; } .header{ text-align: center; background-color: skyblue; padding: 8px; color: white } .left{ width: 160px; float: left; padding: 23px; } .content{ padding: 16px; margin-left: 190px; border-left: 1px solid gray; } .footer{ padding: 8px; color: white; background-color: red; } </style></head><body> <div class='container'> <div class='header'> <h1>backcat1995.com</h1> </div> <div class='left'> <p>黑猫编程教育品牌</p> <p>作者:黑猫</p> </div> <div class='content'> <h2>课程大纲</h2> C++从入门到精通 <br> 玩转数据结构与算法 <br> Python从小白到起飞 </div> <div class='footer'> 地址:火星岩浆路1198弄 </div> </div></body></html> 元素隐藏overflow:
绝对单位和相对单位1.绝对单位,当窗口大小发生改变,不能自适应窗口进行改变
2.相对单位 <style> *{margin: 0; padding: 0;} .box{ width: 50%; height: 50%; background-color: red; } body, html{ height: 100%; } .box2{ width: 50%; height: 50%; background-color: green; }</style><div class='box'> <div class='box2'> </div></div> ![]() 风筝效果
![]() 列表标签
表格标签
表单标签表单用于搜集不同类型的用户输入(用户输入的数据),然后可以把用户数据提交到web服务器。 表单属性设置:
响应式布局Bootstrap响应式最主要特点就是针对不同宽度设备进行布局和样式设置,从而适配不同大小设备。 ![]() 栅格系统: ![]() 显示和隐藏: ![]() |
|