绝对定位百度首页练习

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>百度练习</title>
<style type="text/css">
.top{float: right;position: absolute;top: 10px;right: 10px;}
.top ul li{display: inline; list-style: none;float:left margin-left: 20px;}
.more{background-color: dodgerblue;color: white;border: 0;}
#text1{width:570px;height: 40px;}
#baidu{height: 45px;background-color: dodgerblue;color: white;border: 0;}
#center{margin-top: 140px;margin-left: 350px;}
.under{text-align: center; font-size: smaller;color: darkgrey;position: absolute;left: 450px; bottom: 10px;}
.under a{color: darkgrey;}
</style> </head>
<body> <div class="top"><ul>
<li><a href="#">糯米</a></li>
<li><a href="#">hao123</a></li>
<li><a href="#">地图</a></li>
<li><a href="#">视频</a></li>
<li><a href="#">贴吧</a></li>
<li><a href="#">我的账号</a></li>
<li><a href="#">设置</a></li>
<li><input type="button" class="more" value="更多产品" /></li>
</ul>
</div> <div id="center">
<div class="pic">
<img src="../img/baidu.jpg" />
</div> <div class="center">
<input id="text1" type="text" /><input id="baidu" type="button" value="百度一下" />
</div>
</div> <div class="under">
<a href="#">设为首页</a>
&copy;2016 Baidu <a href="#">使用前必读</a> <a href="#">意见反馈</a>
京ICP证123456号<br />
京安网安备111111111125222001号
</div> </body>
</html>

页面稍复杂的一版

<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>百度一下,你就知道</title>
<style type="text/css"> body,div,form,input{font-size:14px;margin:0;padding:0}
a{color:#0000cc}
a:active{color:#f90}
#top_right{color:#999;font-size:12px;padding:6px 10px;position:absolute;right:0;top:0}
#top_right a{font-size:12px} #main{margin:25px auto 100px auto;padding:0 35px;width:530px}
#main h1{margin-bottom:4px;text-align:center}
#main h1 a img{border:none}
#main ul{list-style-type:none;padding:0 0 0 45px;width:410px}
#main ul li{float:left;margin-right:18px}
#main ul li a.mr{color:#000;font-weight:bold}
#search_form{clear:both;margin-left:15px;padding-top:4px} #keyword{
background:url(
) no-repeat -304px 0px;
border-color:#999 #ccc #ccc #999;
border-style:solid;
border-width:1px;
float:left;
font-size:18px;
height:30px;
line-height:30px;
text-indent:10px;
width:408px;
} #main .search_btn{background:url(
) no-repeat 0 0;border:none;cursor:pointer;float:left;font-size:12px;height:32px;line-height:32px;margin-left:6px;width:95px; }
#main .down_btn{}
#main p{float:left;margin-top:35px;text-align:center;width:520px; }
#cl{clear:both} #footer{margin:50px auto;width:600px}
#footer p{font-size:12px;margin-bottom:15px;text-align:center}
#footer p.jr{margin-bottom:5px}
#footer p a{font-size:12px}
#footer p.bq{color:#77c}
#footer p.bq a{color:#77c}
</style>
</head> <body>
<div id="top_right">
<a href="#">搜索设置</a> | <a href="#">登陆</a> <a href="#">注册</a>
</div>
<div id="main">
<h1>
<a href="#" class="logo"><img src="../img/baidu.jpg"></a></h1>
<ul class="nav">
<li><a href="#">新闻</a></li>
<li><a href="#" class="mr">网页</a></li>
<li><a href="#">贴吧</a></li>
<li><a href="#">知道</a></li>
<li><a href="#">MP3</a></li>
<li><a href="#">图片</a></li>
<li><a href="#">视频</a></li>
<li><a href="#">地图</a></li>
</ul>
<form action="#" method="post" id="search_form">
<input name="" type="text" id="keyword">
<input name="" type="button" value="百度一下" class="search_btn" onmouseout="'this.className='search_btn'" onmousedown="'this.className.down_btn'">
</form>
<p>
<a href="#">空间</a>
<a href="#">百科</a>
<a href="#">hao123</a> |
<a href="#">更多&gt;&gt;</a>
</p><div id="cl"></div>
</div>
<div id="footer">
<p>
<a href="#">把百度设为主页</a>
<a href="#">把百度添加到桌面</a>
</p><p class="jr">
<a href="#">加入百度推广</a> | <a href="#">搜索风云榜</a> | <a href="#">关于百度</a> | <a href="#">About Baidu</a>
</p>
<p class="bq">
2012 Baidu <a href="#">使用百度前必读</a> <a href="#">京ICP证030173号</a>&nbsp;&nbsp;<img src="">
</p>
</div> </body>
</html>

页面简单布局

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>简单布局</title>
<style type="text/css"> /*清除默认样式*/
*{
margin: 0;
padding: 0;
}
.header{
/*设置宽,高,背景色*/
width:1000px;
height:100px;
background-color: yellowgreen;
/*居中*/
margin: 0 auto;
} .content{
width: 1000px;
height: 400px;
background-color: orange;
margin: 10px auto;
}
/*中部div的三个分区的设置*/ .left{
width: 200px;
height: 400px;
background-color: skyblue;
/*向左浮动*/
float: left;
}
.center{
width: 580px;
/*高度也可以用%来表示*/
height: 100%;
background-color: cadetblue;
/*向左浮动*/
float: left; /*设置水平外边距*/
margin: 0 10px;
} .centerheader{
width: 580px;
height:190px;
background-color: darkgoldenrod;
}
.centerfooter{
width: 580px;
height: 190px;
background-color: green;
/*设置上下两个div之间边距为10px*/
margin-top: 10px;
} .right{
width: 200px;
height: 400px;
background-color: grey;
/*向左浮动
* 浮动的块之间没有边距,块与块之间 margin 为0 *
* */
float: left;
} .footer{
/*设置宽,高,背景色*/
width:1000px;
height:100px;
background-color: pink;
/*居中*/
margin: 0 auto;
}
</style>
</head>
<body>
<!--头部div-->
<div class="header"></div>
<!--中间div-->
<div class="content">
<!--中部div水平分区 -->
<div class="left"></div>
<div class="center">
<!--小中部div垂直分区-->
<div class="centerheader"></div>
<div class="centerfooter"></div>
</div>
<div class="right"></div> </div>
<!--底部div-->
<div class="footer"></div> </body>
</html>

html布局小练习(百度首页)的更多相关文章

  1. 微信小程序实现首页图片多种排版布局!

    先来个效果图: 使用技术主要是flex布局,绝对定位布局,小程序前端页面开发,以及一些样式! 直接贴代码,都有详细注释,熟悉一下,方便以后小程序开发! wxml: <view class='in ...

  2. 【教程】手把手教你如何利用工具(IE9的F12)去分析模拟登陆网站(百度首页)的内部逻辑过程

    [前提] 想要实现使用某种语言,比如Python,C#等,去实现模拟登陆网站的话,首先要做的事情就是使用某种工具,去分析本身使用浏览器去登陆网页的时候,其内部的执行过程,内部逻辑. 此登陆的逻辑过程, ...

  3. html+css 百度首页练习

    这几天看完了<css权威指南>,写了个百度页面,不带js的纯静态,主要目的就是掌握页面布局,字体颜色之类的没有深究. 写完了觉得很简单,毕竟一开始觉得只要模仿的像就行,但是缩小了浏览器窗口 ...

  4. Selenium2学习-009-WebUI自动化实战实例-007-Selenium 8种元素定位实战实例源代码(百度首页搜索录入框及登录链接)

    此 文主要讲述用 Java 编写 Selenium 自动化测试脚本编写过程中,通过 ID.name.xpath.cssSelector.linkText.className.partialLinkTe ...

  5. 一款基于jQuery的仿百度首页滑动选项卡

    今天给大家分享一款基于jQuery的仿百度首页滑动选项卡.这款选项卡适用浏览器:IE8.360.FireFox.Chrome.Safari.Opera.傲游.搜狗.世界之窗.效果图如下: 在线预览   ...

  6. selenium2入门 用testNG对百度首页输入框进行测试 (三)

    如果还没有安装testNG的亲,可以点击http://www.cnblogs.com/milanmi/p/4346580.html查看安装过程. 这节主要是对百度首页的输入框进行输入测试. packa ...

  7. 第八十四节,css布局小技巧及font-awesome图标使用

    css布局小技巧及font-awesome图标使用 图片鼠标放上去遮罩效果,显示文字 当鼠标放上去时 /*最外层div*/ .a{ width: 384px; height: 240px; backg ...

  8. 云计算之路-阿里云上:访问阿里云CDN上的图片,自动跳转到百度首页

    昨天有用户向我们反馈一篇博文(一条语句导致CPU持续100%)中的部分图片不能显示,我们的图片访问用的是阿里云CDN,原以为是某个CDN节点不稳定的问题,但在排查时发现这些图片不能显示竟然是因为请求时 ...

  9. 为什么百度首页的HTML源代码最后一行要多一行?浪费空间呀!

     为什么百度首页的HTML源代码最后一行要多一行?浪费空间呀!

随机推荐

  1. 【iCore3应用开发平台】发布 iCore3 应用开发平台使用说明

    PDF下载地址:http://pan.baidu.com/s/1c2ca2lU

  2. ios-UserDefaults

    //单例设计模式 /* 1.单例是一种设计模式 是开发人员在开发过程中总结出来的简单方法 2. 如果某个对象在整个工程中有且只有一个(唯一的)就必须使用单例设计模式创建该对象 3.单例设计模式创建的对 ...

  3. JDK环境变量设置

    1,新建JAVA_HOME变量 .  E:\TOOLS\JAVA\JDK1.8.0_111 2,新建CLASSPATH变量 . .;%JAVA_HOME%\lib;%JAVA_HOME%\lib\to ...

  4. C#中图片新增水印

    /// <summary> /// 在图片上生成图片水印 /// </summary> /// <param name="Path">原服务器图 ...

  5. jvisualVM 分析heapdump

    代码很简单,eclipse里面设置下最大堆空间为128m,: @Test public void testOutOfMemory() { List<NewsAddDto> document ...

  6. reset 单个文件 回退

    git将单个文件恢复到历史版本的正确方法如下: git reset commit_id 文件路径 git checkout -- 文件路径

  7. 一篇文章让Oracle程序猿学会MySql【未完待续】

    一篇文章让Oracle DB学会MySql[未完待续] 随笔前言: 本篇文章是针对已经能够熟练使用Oracle数据库的DB所写的快速学会MySql,为什么敢这么说,是因为本人认为Oracle在功能性方 ...

  8. ceph network introduce

    网络结构 Ceph 使用以太网连接内部各存储节点以及连接 client 和集群.Ceph 推荐使用两个网络: 前端(北向)网络( a public (front-side) network):连接客户 ...

  9. Android 基于Android的手机邮件收发(JavaMail)之四(邮件的发送)

    上一个邮件的接受,因为不当操作,保存未完成,一切东西都得从头开始那就先从邮件发送来吧. 先下我们做一个较为简单的邮件发送 以下是源代码:相信看过上篇文章所给连接的人,对于javamail应该都有了一定 ...

  10. jenkins配置邮件

    1.安装 Email Extension Plugin 插件 2.进入系统管理--系统设置 3.按照如下图设置 首先找到 Extended E-mail Notification