Home Web Front-end CSS Tutorial Code for freely extending three-column layout of div layout_Experience exchange

Code for freely extending three-column layout of div layout_Experience exchange

May 16, 2016 pm 12:07 PM
div code layout

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "../../../www.w3.org/TR/xhtml1/DTD/strict.dtd">  
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="zh-CN"> 
<head> 
<title>自由伸展的三栏式版面</title> 
<meta name="Big John" content="August 24, 2002" /> 
<meta http-equiv="content-Type" content="text/html; charset=GB2312" />  
<meta name="mssmarttagspreventparsing" content="true" /> 
<meta name="keywords" content="demo,test,big john,big,john,positioniseverything,css,html,what else do you want from me!?" /> 
<meta name="description" content="A demo of 3 fluid, full height columns, including header and footer, all with different BGs. " /> 
<meta name="distribution" content="global" /> 
<meta name="resource-type" content="document" /> 
<meta name="robots" content="all" /> 
<meta http-equiv="imagetoolbar" content="no" /> 
<meta http-equiv="pragma" content="no-cache" /> 

<style type="text/css"> 
<!-- 

html {margin: 0; padding: 0;} 

body {margin: 0; padding: 0; font-family: "Palatino Linotype", Georgia, "Times New Roman", Times, serif;  
  font-size: small; background: #ee8 repeat-y url(images/browncol.gif);} 
/*** Image is 180px wide, and 20px high ***/ 

pre {margin: 0; font-family: verdana, sans-serif; font-size: .9em;} 

a {color: #000;} 

.alignright {margin-top: 0; text-align: right;} 

.small {font-size: .9em;} 

.return {position: absolute; top: 0; right: 0; text-align: right; padding: .5em;} 

/******************************************************************************* 
                       Positioning rules 
*******************************************************************************/ 
h1, h2 { 
font-size: 22px; 
margin: 0; 
color: #040; 
background-color: #c83;    /*** The header and footer have backgrounds, to cover the 2-tone body BG  ***/ 
border-top: 4px solid #000; 
border-bottom: 5px solid #000; 
padding: 3px 0 3px 1em; 
} 

h2 {background-color: #638; color: #fff;} 

div#leftbox {      /*** No side padding or borders, to avoid the IE5.x box model problem ***/ 
position: absolute; 
left: 10px; 
width: 150px; 
color: #ee8; 
padding-top: 10px; 
} 

#middlebox { 
margin: 0 34% 0 170px; 
border-left: 3px solid #000; 
border-right: 3px solid #000; 
padding: 10px; 
background-color: #dda;     /*** This div has a background to cover the 2-tone body BG ***/ 
} 

div#rightbox {    /*** No side padding or borders, to avoid the IE5.x box model problem ***/ 
position: absolute; 
right: 25px;     /*** IE5/mac will show a horizontal scrollbar  
        if this is less than 16px, or other units are used 
        http://www.l-c-n.com/IE5tests/right_pos/ ***/            
width: 30%; 
color: #820; 
padding-top: 10px; 
} 

--> 
</style> 
</head> 

<body> 

<h1> 
自由伸展的三栏式版面(Three Column Stretch)(页首) 
</h1> 

<div id="leftbox"> 
<pre class="brush:php;toolbar:false"> 
<strong>#leftbox</strong> { 
position: absolute; 
left: 10px; 
width: 180px(150px?); 
} 
Copy after login
 

  这个栏段的背景是利用 body 卷标设定的图片,以垂直方向重复贴上所产生的。图片的宽度和中间栏段的左边界(margin)相等,高度为20px,这样可以减少图片重复的次数,加快演算上色的速度。 

 

  这一栏的内容(#leftbox)以绝对位置(absolutely positioned)的方式放在左边的区域。另外因为底层背景图片的尺寸限制,需要给定一个以像素作单位的"宽度(width)"值。 

 

  测试用连结 

 
       
 
<strong>#rightbox</strong> { 
position: absolute; 
right: 2%; 
width: 30%; 
} 

Copy after login
 

  这个栏段也能显示"body"的背景,但是因为"body"的背景  图片只在垂直方向重复,而且仅与中间栏段的左边界同宽,所以这边显示的是"body"的背景颜色(background-color)。   这个栏段的"宽度(width)"和右边界的区域是用百分比作单位,你想用其它单位也可以。 

 

  如果页面比 640px 还窄,中间和右边栏段使用的"pre"卷标会导致内容重叠。 

 

  测试用连结 

 
   
  返回 p.i.e. 
 
 
<strong>#middlebox</strong> {  
margin: 0 34% 0 170px; 
border-left: 2px solid #000; 
border-right: 2px solid #000; 
padding: 0 10px 10px; 
background-color: #6b9; 
} 
Copy after login
 

  中间栏段有设定背景色,以便跟右边栏段作区分。  这个栏段也需要补白(padding)和边框(border),不过因为没有设定"宽度(width)"属性,并不会触发 IE5.x 的区块模块(box model)问题。 

 

  这个栏段也必须是最长的栏段,并且用你支持的最大分辨率(resolution)浏览时,仍要能够延伸到检视区(viewport)底端下方,否则"body"的背景就会在页尾(footer)下方出现。 

 

  这整个范例没有在任何栏段里宣告"高度(height)"属性,这是为了避掉一些浏览器表现"高度(height)"属性的独特方式。  因为这些条件的限制,这个版面非常适合那些总是有很长的中间栏段的网页,像是 weblogs。 

 

  页首、页尾和中间栏段是"固定的(static)"(或说"相对的(relative)"),而这三者一起定义了网页的尺寸。你可以帮页首和页尾指定"高度(height)"。 

 

  在原始文件里,以绝对位置表示的 div#rightbox 放置在 div#leftbox 之后,  因此这些 div 的"top"属性可以忽略。  这会让它们待在它们该在的垂直方向起点,也就是说它们是固定的(直接连在固定的页首下)。  所以如果页首因为额外的内容扩大,三个栏段都会往下调整,这样不是很棒吗? 

 

  Mozilla 中,因为垂直方向的舍入误差(rounding error),在某些分辨率里,页尾下方可能有 1px 的空隙,  这个范例描述得更详细。 

 

  Nav4 中没办法使用像"div#leftbox"这类语法,所以请用"#leftbox"来代替。我的写法只是为了要明确地表示。 

 

  致谢:再次感谢Philippe Wittenbergh  ,因为他的帮忙,让这个范例更为完善。更感谢   Mark Howells  ,因为他提供了最初的 body 背景点子。  

    Big John    e-mail   ©positioniseverything   最后更新日期: September 6, 2002   Created August 24, 2002 

    繁体中文翻译:yyhuang   简体中文转换:   onestab   

  以下是填满栏段用的   Why don't cannibals eat clowns?   Answer: They taste funny.   What is the difference between a lousy golfer and a lousy skydiver?   Answer: A lousy golfer goes WHAP! "Oh crap!". A lousy skydiver goes "Oh crap!" WHAP!   Did you hear about the geneticist that tried to cross a potato and a chicken?   He wanted to produce a chicken that would definitely NOT cross the road, but instead,   got a bunch of potatoes that sat around pecking eachother's eyes out.   How many Psychiatrists does it take to change a light bulb?   Answer: Only one, but the bulb has to really want to change.   Why did the egg cross the road?   Answer: It had an inclination. 

 
 

  自由伸展的三栏式版面(Three Column Stretch)(页尾) 

   
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
3 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 solve win7 driver code 28 How to solve win7 driver code 28 Dec 30, 2023 pm 11:55 PM

Some users encountered errors when installing the device, prompting error code 28. In fact, this is mainly due to the driver. We only need to solve the problem of win7 driver code 28. Let’s take a look at what should be done. Do it. What to do with win7 driver code 28: First, we need to click on the start menu in the lower left corner of the screen. Then, find and click the "Control Panel" option in the pop-up menu. This option is usually located at or near the bottom of the menu. After clicking, the system will automatically open the control panel interface. In the control panel, we can perform various system settings and management operations. This is the first step in the nostalgia cleaning level, I hope it helps. Then we need to proceed and enter the system and

What to do if the blue screen code 0x0000001 occurs What to do if the blue screen code 0x0000001 occurs Feb 23, 2024 am 08:09 AM

What to do with blue screen code 0x0000001? The blue screen error is a warning mechanism when there is a problem with the computer system or hardware. Code 0x0000001 usually indicates a hardware or driver failure. When users suddenly encounter a blue screen error while using their computer, they may feel panicked and at a loss. Fortunately, most blue screen errors can be troubleshooted and dealt with with a few simple steps. This article will introduce readers to some methods to solve the blue screen error code 0x0000001. First, when encountering a blue screen error, we can try to restart

The computer frequently blue screens and the code is different every time The computer frequently blue screens and the code is different every time Jan 06, 2024 pm 10:53 PM

The win10 system is a very excellent high-intelligence system. Its powerful intelligence can bring the best user experience to users. Under normal circumstances, users’ win10 system computers will not have any problems! However, it is inevitable that various faults will occur in excellent computers. Recently, friends have been reporting that their win10 systems have encountered frequent blue screens! Today, the editor will bring you solutions to different codes that cause frequent blue screens in Windows 10 computers. Let’s take a look. Solutions to frequent computer blue screens with different codes each time: causes of various fault codes and solution suggestions 1. Cause of 0×000000116 fault: It should be that the graphics card driver is incompatible. Solution: It is recommended to replace the original manufacturer's driver. 2,

Resolve code 0xc000007b error Resolve code 0xc000007b error Feb 18, 2024 pm 07:34 PM

Termination Code 0xc000007b While using your computer, you sometimes encounter various problems and error codes. Among them, the termination code is the most disturbing, especially the termination code 0xc000007b. This code indicates that an application cannot start properly, causing inconvenience to the user. First, let’s understand the meaning of termination code 0xc000007b. This code is a Windows operating system error code that usually occurs when a 32-bit application tries to run on a 64-bit operating system. It means it should

GE universal remote codes program on any device GE universal remote codes program on any device Mar 02, 2024 pm 01:58 PM

If you need to program any device remotely, this article will help you. We will share the top GE universal remote codes for programming any device. What is a GE remote control? GEUniversalRemote is a remote control that can be used to control multiple devices such as smart TVs, LG, Vizio, Sony, Blu-ray, DVD, DVR, Roku, AppleTV, streaming media players and more. GEUniversal remote controls come in various models with different features and functions. GEUniversalRemote can control up to four devices. Top Universal Remote Codes to Program on Any Device GE remotes come with a set of codes that allow them to work with different devices. you may

What does the blue screen code 0x000000d1 represent? What does the blue screen code 0x000000d1 represent? Feb 18, 2024 pm 01:35 PM

What does the 0x000000d1 blue screen code mean? In recent years, with the popularization of computers and the rapid development of the Internet, the stability and security issues of the operating system have become increasingly prominent. A common problem is blue screen errors, code 0x000000d1 is one of them. A blue screen error, or "Blue Screen of Death," is a condition that occurs when a computer experiences a severe system failure. When the system cannot recover from the error, the Windows operating system displays a blue screen with the error code on the screen. These error codes

Detailed explanation of the causes and solutions of 0x0000007f blue screen code Detailed explanation of the causes and solutions of 0x0000007f blue screen code Dec 25, 2023 pm 02:19 PM

Blue screen is a problem we often encounter when using the system. Depending on the error code, there will be many different reasons and solutions. For example, when we encounter the problem of stop: 0x0000007f, it may be a hardware or software error. Let’s follow the editor to find out the solution. 0x000000c5 blue screen code reason: Answer: The memory, CPU, and graphics card are suddenly overclocked, or the software is running incorrectly. Solution 1: 1. Keep pressing F8 to enter when booting, select safe mode, and press Enter to enter. 2. After entering safe mode, press win+r to open the run window, enter cmd, and press Enter. 3. In the command prompt window, enter "chkdsk /f /r", press Enter, and then press the y key. 4.

A quick guide to learning Python drawing: code example for drawing ice cubes A quick guide to learning Python drawing: code example for drawing ice cubes Jan 13, 2024 pm 02:00 PM

Quickly get started with Python drawing: code example for drawing Bingdundun Python is an easy-to-learn and powerful programming language. By using Python's drawing library, we can easily realize various drawing needs. In this article, we will use Python's drawing library matplotlib to draw a simple graph of ice. Bingdundun is a cute panda who is very popular among children. First, we need to install the matplotlib library. You can do this by running in the terminal

See all articles