Table of Contents
回复讨论(解决方案)
Home Web Front-end HTML Tutorial 左右两边高度自适应,右边宽度为浏览器宽度-200px。这个是怎么理解的呀?_html/css_WEB-ITnose

左右两边高度自适应,右边宽度为浏览器宽度-200px。这个是怎么理解的呀?_html/css_WEB-ITnose

Jun 21, 2016 am 09:28 AM
right width Browser Adaptive


按照图片那样的排版,但是,但是,错了。求正确写法?先谢谢各位啦~~~
不理解右边的那个宽度是怎么写的?还有不知道错了,是不是右边的宽度计算错误了?
<!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>body {	margin:0px 0px;	padding:0px 0px;	color:#fff; text-align:center;}#header {	background:#0175ed;	height:120px; line-height:120px;}#header, #footer, #container {    margin: 0px auto;    width: 100%;}#contentWrap {    margin-left: -200px;    float:right;    width: 100%;	background:#86aef7}#content {    margin-left: 200px;}#side {    float:left;    width: 200px;	background:#55a3f3;}#contentWrap,#side{	min-height: 500px;	height: auto !important;	height: 500px;}#footer {    clear: both;	background:#0175ed;	height:50px; line-height:50px;}</style></head><body><div id="container"><div id="header">高度120px</div><div id="main"><div id="contentWrap"><div id="content">右边宽度100%-200px</div></div><div id="side">左边宽度200px</div></div><div id="footer">底部高度50px</div></div></body></html>
Copy after login


回复讨论(解决方案)

右边宽度100%-200px


左边宽度200px


--》

右边宽度100%-200px

左边宽度200px


width:100%
position: abusote;
left : 0px;
用padding-left:200px; 来占位吧

右边宽度100%-200px


左边宽度200px


--》

右边宽度100%-200px

左边宽度200px


所以,你这个回复是什么意思呢?








高度 自适应 老的浏览器可能不行 所以要 写js计算把








高度 自适应 老的浏览器可能不行 所以要 写js计算把

右边=浏览器宽度-200px,这个怎么理解的呀?

这样做可以实现以上所说布局

<!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>body {	margin:0px 0px;	padding:0px 0px;	color:#fff; text-align:center;}#header {	background:#0175ed;	height:120px; line-height:120px;}#header, #footer, #container {    margin: 0px auto;    width: 100%;}#right,#side{	min-height: 500px;	height: auto !important;	height: 500px;}#side {    float:left;    width: 200px;	background:#55a3f3;}#right {  	background:#86aef7}#footer {    clear: both;	background:#0175ed;	height:50px; line-height:50px;}</style></head><body><div id="container">    <div id="header">高度120px</div>    <div id="main">        <div id="side">左边宽度200px</div>		<div id="right">右边宽度100%-200px</div>    </div>    <div id="footer">底部高度50px</div></div></body></html>
Copy after login
Copy after login

这样做可以实现以上所说布局

<!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>body {	margin:0px 0px;	padding:0px 0px;	color:#fff; text-align:center;}#header {	background:#0175ed;	height:120px; line-height:120px;}#header, #footer, #container {    margin: 0px auto;    width: 100%;}#right,#side{	min-height: 500px;	height: auto !important;	height: 500px;}#side {    float:left;    width: 200px;	background:#55a3f3;}#right {  	background:#86aef7}#footer {    clear: both;	background:#0175ed;	height:50px; line-height:50px;}</style></head><body><div id="container">    <div id="header">高度120px</div>    <div id="main">        <div id="side">左边宽度200px</div>		<div id="right">右边宽度100%-200px</div>    </div>    <div id="footer">底部高度50px</div></div></body></html>
Copy after login
Copy after login
是可以实现,但是,我想知道右边的宽度计算。你这个写法不对吧~~~
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

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
WWE 2K25: How To Unlock Everything In MyRise
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

How to customize the resize symbol through CSS and make it uniform with the background color? How to customize the resize symbol through CSS and make it uniform with the background color? Apr 05, 2025 pm 02:30 PM

The method of customizing resize symbols in CSS is unified with background colors. In daily development, we often encounter situations where we need to customize user interface details, such as adjusting...

How to correctly display the locally installed 'Jingnan Mai Round Body' on the web page? How to correctly display the locally installed 'Jingnan Mai Round Body' on the web page? Apr 05, 2025 pm 10:33 PM

Using locally installed font files in web pages Recently, I downloaded a free font from the internet and successfully installed it into my system. Now...

The text under Flex layout is omitted but the container is opened? How to solve it? The text under Flex layout is omitted but the container is opened? How to solve it? Apr 05, 2025 pm 11:00 PM

The problem of container opening due to excessive omission of text under Flex layout and solutions are used...

Why does a specific div element in the Edge browser not display? How to solve this problem? Why does a specific div element in the Edge browser not display? How to solve this problem? Apr 05, 2025 pm 08:21 PM

How to solve the display problem caused by user agent style sheets? When using the Edge browser, a div element in the project cannot be displayed. After checking, I posted...

How to control the top and end of pages in browser printing settings through JavaScript or CSS? How to control the top and end of pages in browser printing settings through JavaScript or CSS? Apr 05, 2025 pm 10:39 PM

How to use JavaScript or CSS to control the top and end of the page in the browser's printing settings. In the browser's printing settings, there is an option to control whether the display is...

Why can custom style sheets take effect on local web pages in Safari but not on Baidu pages? Why can custom style sheets take effect on local web pages in Safari but not on Baidu pages? Apr 05, 2025 pm 05:15 PM

Discussion on using custom stylesheets in Safari Today we will discuss a custom stylesheet application problem for Safari browser. Front-end novice...

Why does negative margins not take effect in some cases? How to solve this problem? Why does negative margins not take effect in some cases? How to solve this problem? Apr 05, 2025 pm 10:18 PM

Why do negative margins not take effect in some cases? During programming, negative margins in CSS (negative...

How to use locally installed font files on web pages? How to use locally installed font files on web pages? Apr 05, 2025 pm 10:57 PM

How to use locally installed font files on web pages Have you encountered this situation in web page development: you have installed a font on your computer...

See all articles