Table of Contents
回复讨论(解决方案)
Home Web Front-end HTML Tutorial float:left 和 right的问题_html/css_WEB-ITnose

float:left 和 right的问题_html/css_WEB-ITnose

Jun 21, 2016 am 09:23 AM
float left

<div style="width:1000px; margin:0px auto; ">        <div style="float:left; width:400px; border:1px solid red;">            a        </div>        <div style="float:right; width:500px; border:1px solid red;">            b        </div></div>
Copy after login

为什么我这样的代码把窗体缩小后right的div就下来了?


我想要这样的效果:(浏览器缩小left 和 right都不变型)



回复讨论(解决方案)

奇怪,我这里很正常,没有掉下来

奇怪,我这里很正常,没有掉下来


我自己在另外一个项目正常也没有掉下来,但是在这个项目他就会掉下来,不知道是什么属性的影响!
在这个项目里所有的float:left和right 浏览器的窗体缩小都会掉下来的

可是浏览器原因?

可是浏览器原因?


用的是同一个浏览器

你用的说明浏览器??连IE都很正常啊


可是浏览器原因?


用的是同一个浏览器


哪会不会是之前一些定位什么的影响了这里的布局,你clear一下



可是浏览器原因?


用的是同一个浏览器


哪会不会是之前一些定位什么的影响了这里的布局,你clear一下


clear也是一样的,只要在这个项目下的float:left 和right浏览器到某程度就会变形,浏览器最大化是没问题的

body给个最小宽度试试

说错,应该是容器div。或者给容器加 overflow-x:auto;

说错,应该是容器div。或者给容器加 overflow-x:auto;


overflow是没用的 因为我的内容都不超出,我的大层是1000 里面一个400 一个500。


刚没仔细看,什么浏览器?加 display:inline;试试


刚没仔细看,什么浏览器?加 display:inline;试试


什么浏览器都是这样,但是我在别的项目就不会,就这个项目的float:left和right会掉下来
我都不知道什么原因!



刚没仔细看,什么浏览器?加 display:inline;试试


什么浏览器都是这样,但是我在别的项目就不会,就这个项目的float:left和right会掉下来
我都不知道什么原因!


display:inline;没用么?你用QQ截图确认下两个div的宽度,然后……我也不懂了

<div style="width:100%; border:1px solid red; float:left; ">				<div style="float:left; width:400px; border:1px solid red;">				a			</div>			<div style="float:right; width:500px; border:1px solid red;">				b			</div>	</div>
Copy after login

我这个就窜下来了。可能是嵌套层次上有百分比设置的宽度导致的

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

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

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)

What is the maximum value of float? What is the maximum value of float? Oct 11, 2023 pm 05:54 PM

Maximum value of float: 1. In C language, the maximum value of float is 3.40282347e+38. According to the IEEE 754 standard, the maximum exponent of the float type is 127, and the number of digits of the mantissa is 23. In this way, the maximum floating point number is 3.40282347 e+38; 2. In the Java language, the maximum float value is 3.4028235E+38; 3. In the Python language, the maximum float value is 1.7976931348623157e+308.

Which key is left on the keyboard? Which key is left on the keyboard? Mar 13, 2023 pm 02:27 PM

The left keyboard is the left direction key, and the right is the right direction key. Generally, the keyboard is replaced by symbols or arrows. Some keyboards are labeled in English. The keyboard is an instruction and data input device used to operate the equipment, and also refers to the system arrangement. A set of function keys that operate a machine or piece of equipment.

What are the database float lengths? What are the database float lengths? Oct 10, 2023 pm 03:57 PM

Common database float lengths are: 1. The float type length in MySQL can be 4 bytes or 8 bytes; 2. The float type length in Oracle can be 4 bytes or 8 bytes; 3. , The length of the float type in SQL Server is fixed at 8 bytes; 4. The length of the float type in PostgreSQL can be 4 bytes or 8 bytes, etc.

What is the accuracy of float? What is the accuracy of float? Oct 17, 2023 pm 03:13 PM

The precision of float can reach 6 to 9 decimal places. According to the IEEE754 standard, the number of significant digits that the float type can represent is approximately 6 to 9 digits. It should be noted that this is only the theoretical maximum precision. In actual use, due to the rounding error of floating point numbers, the precision of the float type is often lower. When performing floating-point number operations in a computer, precision loss may occur due to the precision limitations of floating-point numbers. In order to improve the precision of floating point numbers, you can use higher precision data types, such as double or long double.

How to convert string to float How to convert string to float Oct 16, 2023 pm 02:03 PM

Can be converted to float via Python, JavaScript, Java, C#, Ruby and PHP. Detailed introduction: 1. Python, enter float_number = float(string_number); 2. JavaScript, enter float_number = parseFloat(string_number);; 3. Java, etc.

What does float mean in c language? What does float mean in c language? Oct 12, 2023 pm 02:30 PM

Float in C language is a data type used to represent single-precision floating point numbers. Floating point numbers are real numbers represented in scientific notation and can represent very large or very small values. Variables of the float type can store values ​​with 6 significant digits after the decimal point. In C language, the float type can be used to operate and store floating point numbers. Its variables can be used to represent decimals, fractions, scientific notation, etc. that need to be accurately represented. Real numbers, unlike integer types, floating point numbers can represent numbers after the decimal point, and can perform four arithmetic operations on decimals.

What are the values ​​of float attribute? What are the values ​​of float attribute? Oct 10, 2023 pm 02:03 PM

The float attribute values ​​include left, right, none, inherit, clearinline-start and inline-end. Detailed introduction: 1. left, the element floats to the left, that is, the element will be as close to the left side of the container as possible, and other elements will surround it on the right side; 2. right, the element floats to the right, that is, the element will be as close to the container as possible On the right, other elements will surround it on the left; 3. The default value of none, the elements will not float, and will be arranged according to the normal document flow, etc.

What is the difference between float and double What is the difference between float and double Oct 11, 2023 pm 05:38 PM

The main differences between float and double lie in precision, storage and calculation speed, range, and use in programming languages. Detailed introduction: 1. The precision is different. Float is a single-precision floating point number, occupying 4 bytes (32 bits), while double is a double-precision floating point number, occupying 8 bytes (64 bits); 2. The storage and calculation speed are different. , double takes up more space and requires more storage space to store values. In applications that require high performance and speed, it may be more efficient to use the float type; 3. Different ranges, etc.

See all articles