hbuilderx 2.9.8 公用css样式_HTML、css项目上手练习
根据下边的效果图完成一个完整网页的制作
1、新建项目
(1)打开HBuilderX新建一个项目
(2)在index.html
文件中添加网页标题:音乐--和谐现场
效果:
2、新建CSS文件
在css文件夹中新建CSS文件,命名main.css
在main.css
中添加代码:body{margin: 0;}
,设置网页与浏览器四周距离为0。也可以在index.html
文件<body>
中添加,如:<body style="margin: 0;">
在index.html
文件<head></head>
中引入css:
<link rel="stylesheet" type="text/css" href="css/main.css"/>
3、布局
(1)最外面制作一个总框
在index.html
文件<body></body>
中添加:
<div class="main"></div>
main.css
文件中添加css样式
.main{width: 1500px;margin: 0 auto;border:1px solid dodgerblue;
}
注:如果<div>
里面是class="main"
,css文件里面就写.main{}
,如果是id="main"
,css文件里面就写#main{}
现在里面还没有内容,也没有设置这个框的高度,所以运行出来是下面这样的:
(2)总框中分出头部、中部、尾部
在index.html
文件<div class="main"></div>
中添加:
<div class="tou"></div>
<div class="zhong"></div>
<div class="wei"></div>
main.css
文件中添加css样式:
.tou{margin-top: 0px;width: 1500px;height: 780px;background-image: url(../images/banner4.jpg);background-repeat:no-repeat ;border:1px solid red;
}.zhong{margin: 70px 100px;border:1px solid red;
}.wei{width: 1500px;height: 510px;margin: 0 auto;background-image: url(../images/bgc.png);background-repeat:no-repeat ;background-size:100%; border:1px solid red;
}
效果:
先将所需要的图片引入images
文件夹中
4、头部的制作:
(1)制作#tou外盒子效果;(前面已经弄好了)
(2)制作#tou1内盒子1效果:包括导航与logo;
在index.html
文件<div class="tou"></div>
中添加:
<div class="tou1"><div class="menu"><ul><li><a href="3">首页</a></li><li><a href="3">关于我们</a></li><li><a href="3">简介</a></li><li><a href="3">团队</a></li><li><a href="3">项目</a></li><li><a href="3">联系我们</a></li></ul></div><div class="logo1"><p align="center"><font face="arial" size="6" color="aliceblue">天堂鸟</font></p><p align="center"><font face="arial" size="4" color="aliceblue">Bird of Paradise</font></p></div>
</div>
css样式:
.tou1{margin-left:70px;margin-right: 70px;margin-top: 50px;height: 100px;border:2px solid red;
}
.menu{width: 800px;height: 40px;margin-left: 80px;margin-top: 50px;float: left;color: aliceblue;}.menu ul{margin: 0;padding: 0;}.menu ul li{font-size:20px;font-weight: bold;float: left;width: 130px;height: 40px;text-align: center;list-style: none;line-height: 40px;}.menu ul li a:link{font-size:20px;font-weight: bold;color: aliceblue;}.menu ul li a:visited{text-decoration: none;color: aliceblue;}.menu ul li a:hover{font-size: 25px;display: block;color: aliceblue;}.menu ul li a:active{text-decoration: none;color: aliceblue;}
.logo1{float: right;margin-right: 60px;margin-top: 40px;height: 100px;
}
(3)制作#tou2内盒子效果:包括标题与段落文字;
在index.html
文件<div class="tou1"></div>
下面添加:
<div class="tou2"><div style="margin-top: 250px;margin-left: 80px;"><font size="7" color="aliceblue">震 撼 来 袭</font><p><font size="5" color="red" face="仿宋">来 自 心 灵 深 处, 无 限 激 情 !</font></p><p><font size="5" color="red" face="rockwell">F r o m d e e p h e a r t , i n f i n i t e p a s s i o n !</font></p></div>
</div>
css样式:
.tou2{height: 440px;width: 1400px;margin: 0 auto;margin-left: 80px;margin-top: 450px;
}
5、中部的制作:
(1)制作#zhong外盒子的效果,居中;(前面已经弄好了)
(2)制作#zhong1内盒子1的效果,标题与段落;
在index.html
文件<div class="zhong"></div>
中添加:
<div class="zhong1" align="center"><blockquote><blockquote><blockquote><h2>我 的 团 队</h2></blockquote></blockquote></blockquote><div class="line"></div><font size="" color="dimgray"><h3>Lorem Ipsum is simply dummy text of the printing and typesetting industry.</h3></font>
</div>
css样式:
.zhong1{margin: 10px 100px;
}
.line{width: 120px;border-bottom: 3px solid #1E90FF;font-size: 20px;font-weight: bold;
}
(3)制作#zhong2内盒子2的效果,包括四个小盒子内容,每个小盒子又包括图片,标题两个内容。
这个我用表格做,用
<div>
也可以,但是那样要达到要求的效果有点困难
在index.html
文件<div class="zhong1"></div>
下添加:
<table id="zhong2" bordercolor="darkgray" border="1" frame="void" cellspacing="20px" cellpadding="0px" align="center" style="margin-top: 30px;"><tr><th><img src="data:images/team1.jpg" width="280" height="280"><div style="color: dimgray;">Elizabeth</div></th><th><img src="data:images/team2.jpg" width="280" height="280"><div style="color: dimgray;">Max Payne</div></th><th><img src="data:images/team3.jpg" width="280" height="280"><div style="color: dimgray;">Diana</div></th><th> <img src="data:images/team4.jpg" width="280" height="280" ><div style="color: dimgray;">Johnny Blaz</div></th></tr>
</table>
6、尾部的制作:
(1)制作#wei外盒子的效果;(前面已经弄好了)
(2)制作#wei1内盒子1的效果,包括段落与span标记;
在index.html
文件<div class="wei"></div>
中添加:
<div class="wei1"><font size="5" color="aliceblue">让你自己可以,订阅我们</font><span><font size="3" color="aliceblue"> Make Yourself Available, Subscribe To Us</font></span>
</div>
css样式:
.wei1{margin: 0 auto;margin-left: 90px;margin-top: 20px;width: 1420px;float: left;
}
(3)制作#wei2内盒子2的效果,包括3个小盒子内容,每个小盒子又包括标题,段落两个内容,最下方是一条直线与段落。
在index.html
文件<div class="wei1"></div>
下面添加:
<div class="wei2"><div class="shang"><div class="block"><font size="4" color="aliceblue">关于我们</font><hr width="75%" align="left" noshade="" size="2" color="coral"><br><font size="" color="darkgray">Lorem Ipsum is simply dummy text of the <p></p>printing and typesetting industry. Lorem <p></p>Ipsum has been the industry's standard <p></p>dummy text ever since the 1500s.</font></div><div class="block"> <font size="4" color="aliceblue">顾客服务</font><hr width="75%" align="left" noshade="" size="2" color="coral"><br><font size="" color="darkgray">Lorem Ipsum is simply dummy text of the <p></p>printing and typesetting industry. Lorem <p></p>Ipsum has been the industry's standard <p></p>dummy text ever since the 1500s.</font></div><div class="block"><font size="4" color="aliceblue">联系我们</font><hr width="75%" align="left" noshade="" size="2" color="coral"><br><font size="" color="darkgray">VISIT US<p></p>MAIL US<p></p>CALL US</font></div></div><hr size="2" noshade=""><p align="center"><font size="" color="aliceblue"><br>Copyright © 2016.云南微蓝科技 All rights reserved.网商创业园 - Collect from 互联网</font></p>
</div>
css样式:
.wei2{margin-top: 20px;margin-left: 90px;height: 450px;float: left;width: 1320px;
}
.block{width: 30%;height:200px;margin-left: 35px;float: left;
}
.shang{width: 1320px;height: 260px;margin-top: 70px;
}
最后,将css样式里面的红边框代码border:1px solid red;
去除,就成功了。其中.tou{}
去掉红边框后将margin-top: 0px;
改为margin-top: -50px;
最终效果:
hbuilderx 2.9.8 公用css样式_HTML、css项目上手练习相关推荐
- html的css样式大全,css样式有哪些?
css样式有3种,分为:内联式css样式.嵌入式css样式.外部式css样式.下面本篇文章就来给大家介绍一下css样式,希望对大家有所帮助. 对CSS三种样式定义及其实例: 内联式css样式 内联式c ...
- html刷新css样式,让IE浏览器即时刷新CSS样式_HTML与CSS教程_电脑知识学习_培训之家...
让IE浏览器即时刷新CSS样式为http://www.pxzj8.com整理发布,类型为HTML与CSS教程,本站还有更多关于html与css教程,css教程,html网页设计教程,css视频教程,c ...
- php控制 css样式,div css样式控制案例
摘要:html> div -css样式控制案例 #box{width:100px; height: 100px; html> div -css样式控制案例 #box{width:100px ...
- CSS样式规则-CSS结构的特点
要想熟练地使用CSS对网页进行修饰,首先要了解CSS样式规则.设置CSS样式的具体语法规则如下. 选择器{属性1:属性值1; 属性2:属性值2; 属性3:属性值3; -} 在上面的样式规则中,选择器用 ...
- html:(22):认识css样式和css的优势
认识CSS样式 CSS全称为"层叠样式表 (Cascading Style Sheets)",它主要是用于定义HTML内容在浏览器内的显示样式,如文字大小.颜色.字体加粗等. 如下 ...
- html 将盒子固定浏览器,浏览器默认css样式表 css之左盒子固定,右盒子自适应的一种实现方式...
浏览器默认css样式表 在页面布局或者是列表布局中,我们经常出现一个场景:左边是固定宽度的盒子,右边自适应:div>label>Open... maoguiyou 2016年09月13日 ...
- Web前端开发——CSS样式之CSS选择器
1. CSS选择器类型 css选择器可分为标签选择器.类别选择器.ID选择器,这里的三种类型主要针对内嵌样式和单独文件样式而言 1.1 标签选择器 1.1.1 测试代码 <!DOCTYPE ht ...
- uni-app封装自己常用的css样式-----自定义css的样式 (便于开发)-----原理简单
我们在开发uni-app的时候,有的时候我们的css代码是常常需要用到的,比如说,比如说居中的问题 .center {position: absolute;top: 50%;left: 50%;tra ...
- html结合css样式作用,css样式表可以实现什么功能?
css(Cascading Style Sheets,层叠样式表),它是一种用来表现HTML或XML等文件样式的计算机语言,是用来表示html样式的一种编程语言,是可以做到网页和内容进行分离的一种样式 ...
最新文章
- P3168 [CQOI2015]任务查询系统 差分+主席树
- 2021年人工神经网络第四次作业-第一题:LeNet对于水果与动物进行分类
- PHP问题 —— Warning: PHP Startup: Unable to load dyna
- 静态路由实验 +http+dns_华为静态路由配置实验
- Word Embedding List|ACL 2020 词嵌入长文汇总及分类
- LeetCode:位运算实现加法
- Android 应用基础知识和应用组件
- encoding/json 方法Marshal的说明
- 国内Linux认证类型详解
- Wix 3.0正式发布
- 删除密码设置对象(PSO)
- 自主安全国产虚拟化平台CNware
- matlab 三维图像 叠加,利用 Matlab构建“波的叠加”图样
- 构建自己的人脉网络——高科技人才在跨国大公司的生存之道(四)
- Python爬虫之抓取豆瓣影评数据
- 【论文阅读】8-Non-local Scan Consolidation for 3D Urban Scenes
- python12306自动抢票为什么进入个人中心_python 12306自动抢票
- word删除页眉下面的横线
- web前端开发浏览器兼容性 - 持续更新
- 华为服务器默认用户名和密码怎么修改,服务器默认用户名和密码
热门文章
- 不会数据驱动?还不快来看看,教你快速搭建数据驱动测试框架
- (java)leetcode852 山脉数组的封顶索引(二分查找法找出数组中最大值的下标)(Peak Index in a Mountain Array)
- PS如何将彩色图片变为黑色线稿
- win7系统下安装cad
- 用java编写验证码程序_编写,验证和分析实时Java应用程序
- 作为嵌入式软件工程师在项目开发时的一些易错总结-05
- 王权富贵:Faster-Rcnn详解
- VUE毕设项目 - 基于SSM的中药店商城系统(含源码+论文)
- 【转】 P2P网络文件共享系统及开发平台调研报告
- Cookie与Session的异同