CSS实战——百度搜索首页

成果

支持搜索内容。
在这里插入图片描述
步骤
一般来说:

  1. 使用css+div进行页面的布局,css一般是用外联进行开发
  2. 使用html进行每一个页面的填充

注意事项

  • id的命名规范:父标签id_自己的id
  • css一般一个选择器一行,没有换行
  • 设置页面基础样式——设置特定标签样式——使用伪类给标签添加样式。

css文件

/* 设置页面基础设置 */
*{padding: 0px;margin: 0px;}
/* 设置header */
#header{width: 100%;height: 40px;}
 #header_nav {float: left;list-style-type: none;position: absolute;right: 90px;top:26px;}
  #header_nav a{margin-left: 24px;color: #333;font-size: 13px;font-weight: 30px;}
/* 设置main */
#main{width:100%;height: 290px;text-align: center;}
	#img_logo{margin-top: 50px;0px;margin-bottom: 20px;}
	input[type=text]{height: 34px;width: 539px;margin-right: 0px;border:solid 1px #4992FF;background-image: url(img/img.png);background-repeat: no-repeat;background-position-x: 500px;}
	input[type=submit]{height: 37px;px;width: 100px;font-size: 15px;color: #fff;background-color: #2d78f4;border: solid 0px;letter-spacing: 1px;position: relative;right: 5px;top:2px}
/* 设置tailer */
#tailer{width: 100%;height: 300px;}
/* 使用伪类给标签加样式 */
#header_nav a:hover{color:blue;}

html文件

<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>百度一下,你就知道</title>
		<!-- 
			1,使用css+div进行页面的布局
				css一般是用外联进行开发
			2,使用html进行每一个页面的填充
		 -->
		 <link rel="stylesheet" type="text/css" href="baidu.css"/>
		 <link href="./img/logo.ico" rel="shortcut icon"/>
	</head>
	<body>
		<!-- 头部 -->
		<div id="header">
			<!-- 命名规范,父标签id_id -->
			<li id="header_nav">
				<a href="https://voice.baidu.com/act/newpneumonia/newpneumonia/?from=osari_pc_1">抗击肺炎</a>
				<a href="http://news.baidu.com/">新闻</a>
				<a href="https://www.hao123.com/">hao123</a>
				<a href="https://map.baidu.com/@13265880.8,4373425.72,12z">地图</a>
				<a href="http://v.baidu.com/">视频</a>
				<a href="https://tieba.baidu.com/index.html">贴吧</a>
				<a href="http://xueshu.baidu.com/">学术</a>
				<a href="">登录</a>
				<a href="">设置</a>
			</li>
		</div>
		<!-- 主体 -->
		<div id="main">
			<form action="https://www.baidu.com/s" method="get">
				<img id="img_logo" src="img/bd_logo1.png" width="270px" height="129px"><br>
				<input type="text" name="wd" id="" value="" />
				<input type="submit" name="" id="" value="百度一下" />
			</form>
		</div>
		<!-- 底部 -->
		<div id="tailer">
			<img src="img/bottom.png" align="center">
		</div>
	</body>
</html>

  • 1
    点赞
  • 10
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值