search
HomeWeb Front-endHTML TutorialRookie question: Two divs cannot be displayed up and down. The lower div covers half of the upper part_html/css_WEB-ITnose

Rookie question, please help

Two divs, I want div1 to go up and div2 to go down like this

The height of div1 cannot be set because the length inside div1 is not fixed

div2 always covers div1. Why? ? ?

The question page is here. I wonder if it can be posted. The footer of an article page cannot be postponed and the content will be covered
http://www.cczxs.com/baojia


Reply to discussion (solution)

Is anyone here?

<html><head><meta charset="utf-8"/><title>test</title><style type="text/css">	#test1{		width:800px;		margin-bottom:10px;		border:2px solid red;	}</style></head><body><div id="test1">百度,全球最大的中文搜索引擎、最大的中文网站。2000年1月创立于北京中关村。1999年底,身在美国硅谷的李彦宏看到了中国互联网及中文搜索引擎服务的巨大发展潜力,抱着技术改变世界的梦想,他毅然辞掉硅谷的高薪工作,携搜索引擎专利技术,于2000年1月1日在中关村创建了百度公司。从最初的不足10人发展至今,员工人数超过17000人。如今的百度,已成为中国最受欢迎、影响力最大的中文网站。百度拥有数千名研发工程师,这是中国乃至全球最为优秀的技术团队,这支队伍掌握着世界上最为先进的搜索引擎技术,使百度成为中国掌握世界尖端科学核心技术的中国高科技企业,也使中国成为美国、俄罗斯、和韩国之外,全球仅有的4个拥有搜索引擎核心技术的国家之一。从创立之初,百度便将“让人们最便捷地获取信息,找到所求”作为自己的使命,成立以来,公司秉承“以用户为导向”的理念,不断坚持技术创新,致力于为用户提供“简单,可依赖”的互联网搜索产品及服务,其中包括:以网络搜索为主的功能性搜索,以贴吧为主的社区搜索,针对各区域、行业所需的垂直搜索,Mp3搜索,以及门户频道、IM等,全面覆盖了中文网络世界所有的搜索需求,根据第三方权威数据,百度在中国的搜索份额超过80%。在面对用户的搜索产品不断丰富的同时,百度还创新性地推出了基于搜索的营销推广服务,并成为最受企业青睐的互联网营销推广平台。目前,中国已有数十万家企业使用了百度的搜索推广服务,不断提升着企业自身的品牌及运营效率。通过持续的商业模式创新,百度正进一步带动整个互联网行业和中小企业的经济增长,推动社会经济的发展和转型。为推动中国数百万中小网站的发展,百度借助超大流量的平台优势,联合所有优质的各类网站,建立了世界上最大的网络联盟,使各类企业的搜索推广、品牌营销的价值、覆盖面均大面积提升。与此同时,各网站也在联盟大家庭的互助下,获得最大的生存与发展机会。作为国内的一家知名企业,百度也一直秉承“弥合信息鸿沟,共享知识社会”的责任理念,坚持履行企业公民的社会责任。成立来,百度利用自身优势积极投身公益事业,先后投入巨大资源,为盲人、少儿、老年人群体打造专门的搜索产品,解决了特殊群体上网难问题,极大地弥补了社会信息鸿沟问题。此外,在加速推动中国信息化进程、净化网络环境、搜索引擎教育及提升大学生就业率等方面,百度也一直走在行业领先的地位。2011年初,百度还特别成立了百度基金会,围绕知识教育、环境保护、灾难救助等领域,更加系统规范地管理和践行公益事业。2005年,百度在美国纳斯达克上市,一举打破首日涨幅最高等多项纪录,并成为首家进入纳斯达克成分股的中国公司。通过数年来的市场表现,百度优异的业绩与值得依赖的回报,使之成为中国企业价值的代表,傲然屹立于全球资本市场。2009年,百度更是推出全新的框计算技术概念,并基于此理念推出百度开放平台,帮助更多优秀的第三方开发者利用互联网平台自主创新、自主创业,在大幅提升网民互联网使用体验的同时,带动起围绕用户需求进行研发的产业创新热潮,对中国互联网产业的升级和发展产生巨大的拉动效应。今天,百度已经成为中国最具价值的品牌之一,英国《金融时报》将百度列为“中国十大世界级品牌”,成为这个榜单中最年轻的一家公司,也是唯一一家互联网公司。而“亚洲最受尊敬企业”、“全球最具创新力企业”、“中国互联网力量之星”等一系列荣誉称号的获得,也无一不向外界展示着百度成立数年来的成就。多年来,百度董事长兼CEO李彦宏,率领百度人所形成的“简单可依赖”的核心文化,深深地植根于百度。这是一个充满朝气、求实坦诚的公司,以搜索改变生活,推动人类的文明与进步,促进中国经济的发展为己任,正朝着更为远大的目标而迈进。。</div><div id="test2">2009年,百度更是推出全新的框计算技术概念,并基于此理念推出百度开放平台,帮助更多优秀的第三方开发者利用互联网平台自主创新、自主创业,在大幅提升网民互联网使用体验的同时,带动起围绕用户需求进行研发的产业创新热潮,对中国互联网产业的升级和发展产生巨大的拉动效应。今天,百度已经成为中国最具价值的品牌之一,英国《金融时报》将百度列为“中国十大世界级品牌”,成为这个榜单中最年轻的一家公司,也是唯一一家互联网公司。而“亚洲最受尊敬企业”、“全球最具创新力企业”、“中国互联网力量之星”等一系列荣誉称号的获得,也无一不向外界展示着百度成立数年来的成就。多年来,百度董事长兼CEO李彦宏,率领百度人所形成的“简单可依赖”的核心文化,深深地植根于百度。这是一个充满朝气、求实坦诚的公司,以搜索改变生活,推动人类的文明与进步,促进中国经济的发展为己任,正朝着更为远大的目标而迈进。</div></body></html>

Try it, don’t set the height of div1, use margin -bottom to adjust the spacing

Try setting zindex

Try, do not set the height of div1, use margin-bottom to adjust the spacing



Settings Margin-bottom is off, I don’t know why, it may have other effects

Try, don’t set the height of div1, use margin-bottom to adjust the spacing


Solution, go to the top A div is set to float


Try, instead of setting the height of div1, use margin-bottom to adjust the spacing


Solution, the previous div is set to float
I haven’t set float on both divs, but the lower one still covers part of the upper one. Why?
Statement
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
Difficulty in updating caching of official account web pages: How to avoid the old cache affecting the user experience after version update?Difficulty in updating caching of official account web pages: How to avoid the old cache affecting the user experience after version update?Mar 04, 2025 pm 12:32 PM

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,

How do I use HTML5 form validation attributes to validate user input?How do I use HTML5 form validation attributes to validate user input?Mar 17, 2025 pm 12:27 PM

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

What are the best practices for cross-browser compatibility in HTML5?What are the best practices for cross-browser compatibility in HTML5?Mar 17, 2025 pm 12:20 PM

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

How to efficiently add stroke effects to PNG images on web pages?How to efficiently add stroke effects to PNG images on web pages?Mar 04, 2025 pm 02:39 PM

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

What is the purpose of the <datalist> element?What is the purpose of the <datalist> element?Mar 21, 2025 pm 12:33 PM

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

What is the purpose of the <progress> element?What is the purpose of the <progress> element?Mar 21, 2025 pm 12:34 PM

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

How do I use the HTML5 <time> element to represent dates and times semantically?How do I use the HTML5 <time> element to represent dates and times semantically?Mar 12, 2025 pm 04:05 PM

This article explains the HTML5 <time> element for semantic date/time representation. It emphasizes the importance of the datetime attribute for machine readability (ISO 8601 format) alongside human-readable text, boosting accessibilit

What is the purpose of the <meter> element?What is the purpose of the <meter> element?Mar 21, 2025 pm 12:35 PM

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

See all articles

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)
2 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
Repo: How To Revive Teammates
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

PhpStorm Mac version

PhpStorm Mac version

The latest (2018.2.1) professional PHP integrated development tool

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

mPDF

mPDF

mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

Safe Exam Browser

Safe Exam Browser

Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.