Three rows parallel_html/css_WEB-ITnose
1 <div class="content">2 <div class="left"></div>3 <div class="center"></div>4 <div class="right"></div>5 </div>
1 body{margin:0;padding:0;}2 .content div{3 width:100px;4 height:100px;5 background:rgb(147,172,213);6 margin:10px;7 }
Method 1: float
1 .content div{float:left;}
The three divs float together, and there is no problem of merging margins on floating elements, so the left and right margins of the center are both 20px.
Method 2: Absolute positioning
1 .content {position:relative;}2 .content div{position:absolute;}3 div.center{top:0;left:110px;}4 div.right{top:0;left:220px;}
Set the parent element to relative and the positioned child element to Absolute, absolute positioning does not take up space, so at this time the three elements will overlap the vertices of the parent element, and then use top and left to layout the left and right margins of 10px.
Method 3: inline-block
1.content div{display:inline-block;}
Change it Change it to an inline block element, but there will be extra spacing between divs and there will be more compatibility issues.
Method 4: Negative margin
1 div.center{2 margin-left:120px;/*100+10*2=120px 以下数值都以center左右margin为10px考虑*/3 margin-top:-110px;/*100+10=110px 要想用margin-top实现上移,则其值为负*/4 }5 div.right{6 margin-left:230px;/*100*2+10*3=230px*/7 margin-top:-110px;/*当center上去之后,原占位空间不存在,right上移,故再移动需要的高度与center一致为100+10=110px。而如果先写right,margin-top就应该上移(100+10)*2=220px*/8 }
When the network speed is slow or the refresh frequency is high, Using negative margin values will cause significant movement, so this method is not recommended.

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

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

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

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.

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.

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

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

AnexampleofastartingtaginHTMLis,whichbeginsaparagraph.StartingtagsareessentialinHTMLastheyinitiateelements,definetheirtypes,andarecrucialforstructuringwebpagesandconstructingtheDOM.

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

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.

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