Home > Web Front-end > HTML Tutorial > Why can't the width of the three id tag definitions be filled up 100%? _html/css_WEB-ITnose

Why can't the width of the three id tag definitions be filled up 100%? _html/css_WEB-ITnose

WBOY
Release: 2016-06-24 12:04:52
Original
1381 people have browsed it

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>无标题文档</title><style type="text/css">	div{		border:1px solid #039;		text-align:center;			}	#header{		width:100%;		height:80px;	}	.logo{		width:30%;		background-color:#0fc;		float:left;	}	.today{		width:30%;		background-color:#ccc;		float:left;	}	.search{		width:39.5%;/*定义为40%会导致搜索栏不能和前两个在同一行。*/		background-color:#cf9;		float:left;	}	</style></head><body>	<div id="header">    	<div class="logo">网站Logo</div>        <div class="today">当前日期</div>        <div class="search">搜索栏</div>    </div></body></html>
Copy after login


Reply to discussion (solution)

You style all divs
div{
border:1px solid #039;
text-align: center;

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template