Table of Contents
Reply to discussion (solution)
Home Web Front-end HTML Tutorial Rookie question: Two divs cannot be displayed up and down. The lower div covers half of the upper part_html/css_WEB-ITnose

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

Jun 24, 2016 am 11:54 AM

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>
Copy after login

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 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

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

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)

Is HTML easy to learn for beginners? Is HTML easy to learn for beginners? Apr 07, 2025 am 12:11 AM

HTML is suitable for beginners because it is simple and easy to learn and can quickly see results. 1) The learning curve of HTML is smooth and easy to get started. 2) Just master the basic tags to start creating web pages. 3) High flexibility and can be used in combination with CSS and JavaScript. 4) Rich learning resources and modern tools support the learning process.

The Roles of HTML, CSS, and JavaScript: Core Responsibilities The Roles of HTML, CSS, and JavaScript: Core Responsibilities Apr 08, 2025 pm 07:05 PM

HTML defines the web structure, CSS is responsible for style and layout, and JavaScript gives dynamic interaction. The three perform their duties in web development and jointly build a colorful website.

Understanding HTML, CSS, and JavaScript: A Beginner's Guide Understanding HTML, CSS, and JavaScript: A Beginner's Guide Apr 12, 2025 am 12:02 AM

WebdevelopmentreliesonHTML,CSS,andJavaScript:1)HTMLstructurescontent,2)CSSstylesit,and3)JavaScriptaddsinteractivity,formingthebasisofmodernwebexperiences.

What is an example of a starting tag in HTML? What is an example of a starting tag in HTML? Apr 06, 2025 am 12:04 AM

AnexampleofastartingtaginHTMLis,whichbeginsaparagraph.StartingtagsareessentialinHTMLastheyinitiateelements,definetheirtypes,andarecrucialforstructuringwebpagesandconstructingtheDOM.

Gitee Pages static website deployment failed: How to troubleshoot and resolve single file 404 errors? Gitee Pages static website deployment failed: How to troubleshoot and resolve single file 404 errors? Apr 04, 2025 pm 11:54 PM

GiteePages static website deployment failed: 404 error troubleshooting and resolution when using Gitee...

How to implement adaptive layout of Y-axis position in web annotation? How to implement adaptive layout of Y-axis position in web annotation? Apr 04, 2025 pm 11:30 PM

The Y-axis position adaptive algorithm for web annotation function This article will explore how to implement annotation functions similar to Word documents, especially how to deal with the interval between annotations...

HTML, CSS, and JavaScript: Essential Tools for Web Developers HTML, CSS, and JavaScript: Essential Tools for Web Developers Apr 09, 2025 am 12:12 AM

HTML, CSS and JavaScript are the three pillars of web development. 1. HTML defines the web page structure and uses tags such as, etc. 2. CSS controls the web page style, using selectors and attributes such as color, font-size, etc. 3. JavaScript realizes dynamic effects and interaction, through event monitoring and DOM operations.

How to use CSS3 and JavaScript to achieve the effect of scattering and enlarging the surrounding pictures after clicking? How to use CSS3 and JavaScript to achieve the effect of scattering and enlarging the surrounding pictures after clicking? Apr 05, 2025 am 06:15 AM

To achieve the effect of scattering and enlarging the surrounding images after clicking on the image, many web designs need to achieve an interactive effect: click on a certain image to make the surrounding...

See all articles