关于div+CSS排版的疑问_html/css_WEB-ITnose
本来刚开始接触web开发,现在在使用div+css进行排版的时候有一个困惑,如果用百分比对div进行高度设定,那么网页会随缩放变形,感觉不可取。但是用数值进行设定的话,该怎么确定总高度值呢?如果在我的电脑上合适的,在分辨率更高的电脑上,下面不是会空出来一段,显然很难看啊。。一般是怎么解决这个问题的呢?是用javascript根据具体情况动态设定么?求大牛们解惑,谢谢啦!
回复讨论(解决方案)
一个背景平铺占满整个屏幕,主题内容一般宽度在1200-1300左右,高度由内容而定。这个问题一般UI会帮你考虑的,做前端的话,关注好代码逻辑性就行~(但不代表不去接触UI,什么都该了解一点的~)
一个背景平铺占满整个屏幕,主题内容一般宽度在1200-1300左右,高度由内容而定。这个问题一般UI会帮你考虑的,做前端的话,关注好代码逻辑性就行~(但不代表不去接触UI,什么都该了解一点的~)
谢谢,我这不是正想了解嘛~~所以一般是怎么处理的呢?是不是要用的更高级的css技术?比如我看类似bootstrap有自适应什么的?~求稍微多指点一下
bootstrap 就是对各种可能遇到的布局问题进行优化,你只需要记住它的类名,看一下它的api,就知道怎么使用,非常方便。而且有许多交互也都写好了,直接调用就好了。
1 底色尽量用在最底层,以及内容可能最长的一层
2 实在要设置高度的话, { min-height: xxxpx;_height:xxxpx}
3 要用js的话 比较 document.body.clientHeight||document.documentElement.clientHeight 和 .scrollHeight 的差动态设置,还要捕捉resize()事件,效果不一定好.

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

The official account web page update cache, this thing is simple and simple, and it is complicated enough to drink a pot of it. You worked hard to update the official account article, but the user still opened the old version. Who can bear the taste? In this article, let’s take a look at the twists and turns behind this and how to solve this problem gracefully. After reading it, you can easily deal with various caching problems, allowing your users to always experience the freshest content. Let’s talk about the basics first. To put it bluntly, in order to improve access speed, the browser or server stores some static resources (such as pictures, CSS, JS) or page content. Next time you access it, you can directly retrieve it from the cache without having to download it again, and it is naturally fast. But this thing is also a double-edged sword. The new version is online,

This article demonstrates efficient PNG border addition to webpages using CSS. It argues that CSS offers superior performance compared to JavaScript or libraries, detailing how to adjust border width, style, and color for subtle or prominent effect

The article discusses using HTML5 form validation attributes like required, pattern, min, max, and length limits to validate user input directly in the browser.

The article discusses the HTML <datalist> element, which enhances forms by providing autocomplete suggestions, improving user experience and reducing errors.Character count: 159

The article discusses the HTML <progress> element, its purpose, styling, and differences from the <meter> element. The main focus is on using <progress> for task completion and <meter> for stati

The article discusses the HTML <meter> element, used for displaying scalar or fractional values within a range, and its common applications in web development. It differentiates <meter> from <progress> and ex

Article discusses best practices for ensuring HTML5 cross-browser compatibility, focusing on feature detection, progressive enhancement, and testing methods.

The article discusses the <iframe> tag's purpose in embedding external content into webpages, its common uses, security risks, and alternatives like object tags and APIs.
