Let’s talk about relative positioning and absolute positioning in html. Some back-end students are not familiar with the relative positioning and absolute positioning of html. Here comes the bonus, this article talks about the relative positioning and absolute positioning of html in detail!
html is the entire document space, body is the document space in html, the difference between body and html is about 9cm
Relative positioning in postion: relative
Absolute positioning in postion: absolute
Relative positioning:
When there is no reference object , relative positioning is relative to body positioning
Absolute positioning:
When there is no reference object, absolute positioning is relative to html positioning
When using margin, it takes up document space. It is generally used in relative positioning.
When using top, left, right, button, it does not occupy document space. , use it depending on the situation
We usually use absolute within relative to develop the project
#divAddress{ position: relative; margin-top: 48px;//这就是刚才提的当使用margin的时候才能进行下面的相对 width: 370px; height: 66px; border-bottom: 1px #c1c1c1 solid; } #img1{ position: absolute; float: left;margin-top:2px; width: 24px; height: 24px; } .address{ position: absolute; margin-left: 34px; font-size: 20px; color: #c1c1c1; } #peoplePost1{ position: relative; margin-top: 12px; width: 370px; height: 40px; border-bottom: 1px #c1c1c1 solid; } #people1{ position: absolute; float: left;margin-top:2px; width: 24px; height: 24px; } .people2{ position: absolute; margin-left: 34px; font-size: 20px; color: #c1c1c1; } #post1{ position: absolute; float: left;margin-top:2px;margin-left:192px; width: 24px; height: 24px; } .post2{ position: absolute; margin-left: 222px; font-size: 20px; color: #c1c1c1; } <div id="divAddress"> <img src="/static/imghwm/default1.png" data-src="<%=request.getContextPath()% alt="Relative positioning and absolute positioning in html" >/images/address.png" class="lazy" id="img1" alt="address" > <div class="address">地址 : <span style="font-weight: 600;color: black;">输入上海市卢湾区卢湾榜路758弄10号1011室</span></div> </div> <div id="peoplePost1"> <img src="/static/imghwm/default1.png" data-src="<%=request.getContextPath()% alt="Relative positioning and absolute positioning in html" >/images/people.png" class="lazy" id="people1" alt="people" > <div class="people2">联系人 : <span style="font-weight: 600;color: black;">张三</span></div> <img src="/static/imghwm/default1.png" data-src="<%=request.getContextPath()% alt="Relative positioning and absolute positioning in html" >/images/post.png" class="lazy" id="post1" alt="post" > <div class="post2">职位 : <span style="font-weight: 600;color: black;">业务经理</span></div> </div>
The above is the html code that combines relative and absolute. The above is all the content of this article. I hope It can help everyone!
Related recommendations:
#How to use the absolute path and relative path of html
Applicable conditions for relative positioning or absolute positioning
Detailed code explanation of eight ways to achieve centering with css absolute positioning
The above is the detailed content of Relative positioning and absolute positioning in html. For more information, please follow other related articles on the PHP Chinese website!

本篇文章带大家了解一下HTML(超文本标记语言),介绍一下HTML的本质,HTML文档的结构、HTML文档的基本标签和图像标签、列表、表格标签、媒体元素、表单,希望对大家有所帮助!

不算。html是一种用来告知浏览器如何组织页面的标记语言,而CSS是一种用来表现HTML或XML等文件样式的样式设计语言;html和css不具备很强的逻辑性和流程控制功能,缺乏灵活性,且html和css不能按照人类的设计对一件工作进行重复的循环,直至得到让人类满意的答案。

总结了一些web前端面试(笔试)题分享给大家,本篇文章就先给大家分享HTML部分的笔试题(附答案),大家可以自己做做,看看能答对几个!

HTML5中画布标签是“<canvas>”。canvas标签用于图形的绘制,它只是一个矩形的图形容器,绘制图形必须通过脚本(通常是JavaScript)来完成;开发者可利用多种js方法来在canvas中绘制路径、盒、圆、字符以及添加图像等。

在html中,document是文档对象的意思,代表浏览器窗口的文档;document对象是window对象的子对象,所以可通过“window.document”属性对其进行访问,每个载入浏览器的HTML文档都会成为Document对象。

html5废弃了dir列表标签。dir标签被用来定义目录列表,一般和li标签配合使用,在dir标签对中通过li标签来设置列表项,语法“<dir><li>列表项值</li>...</dir>”。HTML5已经不支持dir,可使用ul标签取代。

3种取消方法:1、给td元素添加“border:none”无边框样式即可,语法“td{border:none}”。2、给td元素添加“border:0”样式,语法“td{border:0;}”,将td边框的宽度设置为0即可。3、给td元素添加“border:transparent”样式,语法“td{border:transparent;}”,将td边框的颜色设置为透明即可。


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

MinGW - Minimalist GNU for Windows
This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

DVWA
Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

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

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

Atom editor mac version download
The most popular open source editor
