float: left solve_html/css_WEB-ITnose

WBOY
Release: 2016-06-24 11:46:07
Original
921 people have browsed it

http://paste.ubuntu.com/10826550/
How do you make this float? Why does it not float after adding float: left?


Reply to the discussion (solution)

I just want the li elements to be placed horizontally together. But after adding floats to li, the first one floated

Okay, I understand, the width is not enough

<!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=gb2312" /><title>列表模式的导航</title><style type="text/css">.site_nav {		width:800px; }.site_nav h1 {	display:none; }#nav ul, #nav li {	list-style:none;	padding:0;	margin:0;}#nav li {			height:22px;float:left;}#nav li a {	display:block;	height:100%; 	text-align:center; 	text-decoration:none; 	font:normal 12px/22px "宋体", Verdana,Lucida, Arial, Helvetica, sans-serif;	color:#FFFFFF;		background-color:#333333;}#nav li a:hover {	color:#000000;	background-color:#E8E8E8;}</style></head><body><div class="site_nav">	<h1>站点导航</h1>	<map id="nav">		<ul>			<li><a href="#">首页</a></li>			<li><a href="#">个人介绍</a></li>			<li><a href="#">作品展示</a></li>			<li><a href="#">联系我们</a></li>		</ul>	</map></div></body></html>
Copy after login

There are two places missing." }”

<!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=gb2312" /><title>列表模式的导航</title><style type="text/css">.site_nav {	width:400px; }.site_nav h1 {	display:none; }#nav ul, #nav li {	list-style:none;	padding:0;	margin:0;}#nav li {	float: left;	height:22px; }#nav li a {	padding: 0px 5px;	display:block;	height:100%; 	text-align:center; 	text-decoration:none; 	font:normal 12px/22px "宋体", Verdana,Lucida, Arial, Helvetica, sans-serif;	color:#FFFFFF;	background-color:#333333;}#nav li a:hover {	color:#000000;	background-color:#E8E8E8;}</style></head><body><div class="site_nav">	<h1>站点导航</h1>	<map id="nav">		<ul>			<li><a href="#">首页</a></li>			<li><a href="#">个人介绍</a></li>			<li><a href="#">作品展示</a></li>			<li><a href="#">联系我们</a></li>		</ul>	</map></div></body></html>
Copy after login

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