Home > Web Front-end > HTML Tutorial > The problem with maigin-left being a negative number! _html/css_WEB-ITnose

The problem with maigin-left being a negative number! _html/css_WEB-ITnose

WBOY
Release: 2016-06-24 12:04:36
Original
1330 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">/*并列浮动布局,该类型为固定宽度布局。*/    	body{			margin:0px;			padding-left:180px;			padding-right:240px;			min-width:480px; /*定义浏览器为最小窗口宽度,该值为第2列 第3列宽度和。*/		}		div{			border:1px solid gray;			height:40px;		}		#left{			width:180px;			float:left;			margin-left:-180px;/*设置偏移宽度为左列宽度,注意取值为负数。*/		}		#middle{			width:240px;			float:left;		}		#right{			width:240px;			float:left;			margin-right:-100%;		}    </style></head><body>	<div id="left">左列</div>    <div id="middle">中列</div>    <div id="right">右列</div></body></html>
Copy after login

#left definition: Why should the offset width be set to a negative number here? Doesn't the default DIV start from the left?


Reply to the discussion (solution)

If the padding-left=180px in the body is not written -180px, then the browser is not Can’t you see it starts from the left?

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