Home > Web Front-end > HTML Tutorial > div css page layout, how to set the content height to 100% instead of specific pixels_html/css_WEB-ITnose

div css page layout, how to set the content height to 100% instead of specific pixels_html/css_WEB-ITnose

WBOY
Release: 2016-06-24 12:08:31
Original
1669 people have browsed it

I found some examples, but the content height can only use specific pixels. If you use percentages, the height displayed in the browser will be 0.

HTML5 should no longer support frames, but the csdn forum is still using frameset. How to use div css to replace the frame effect? Thanks!

[csdn frame source code]






[DIV CSS source code]



The left side of the 2 columns is fixed, Adaptive width on the right side, seamless in the middle??Standard Roadwww.aa25.cn

                                                                                                                             ;


Reply to discussion (solution)

js resize adjustment

Looking for answers downstairs. . .

Correct answer on the 1st floor, you need to use js resize

The specific usage is: get the height of the page window, then assign the height value to content, use the window function resize when the window size changes, and calculate the window again Just assign the height to the content

1. Use JS for real-time judgment

2. Pure CSS

<!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>html, body {	width:100%;	height:100%;	margin:0;	padding:0;}</style></head><body><style type="text/css">#container {margin:0 auto; width:100%;height:100%}#sidebar { float:left; width:200px; height:100%; background:#9c6;}* html #sidebar{margin-right:-3px;}/*使用此方法解决ie 3像素bug可通过验证*/#content { height:100%; background:#ffa;}</style><div id="container">  <div id="sidebar">This is the sidebar</div>  <div id="content">2列左侧固定,右侧自适应宽度,中间无缝型??<a href="http://www.aa25.cn">标准之路www.aa25.cn</a><span style="display:none">    <script language="javascript" type="text/javascript" src="http://js.users.m.sbmmt.com/1967272.js"></script>    </span><br />    <br />    <a href="/layout/29.(l+∽).rar">下载此模板</a></div></div></body></html>
Copy after login

Thank you! The purpose is to be more consistent with HTML5. The compatibility of such complex CSS in various browsers may be a problem. Let’s use table. Thanks again!



Correct answer on the 1st floor, you need to use js resize
The specific usage is: get the height of the page window, and then assign the high value to the content, use the window function resize when the window size changes, Just calculate the height of the window again and assign it to the content

Thank you

js resize adjustment

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