Giter Site home page Giter Site logo

float's Introduction

float异常汇总

1.背景不能显示,边框不能撑开。(直接上代码)

未浮动代码

<!DOCTYPE html>
<html>
<head>
	<title>css float</title>
</head>
<body>
	<div class="" style="background: green;border: 1px solid">
		<div class="" style="background: red;width: 100px;height: 100px;">
		</div>
	</div>
</body>
</html>

效果如下:
未浮动效果

下面添加浮动之后父级将不会被展开

<!DOCTYPE html>
<html>
<head>
	<title>css float</title>
</head>
<body>
	<div class="" style="background: green;border: 1px solid">
		<div class="" style="background: red;width: 100px;height: 100px;float: left;">
		</div>
	</div>
</body>
</html>

效果如下:
浮动效果

2.添加浮动后,父级的padding不能正确显示,margin 效果尚可

未浮动代码

<!DOCTYPE html>
<html>
<head>
	<title>css float</title>
</head>
<body>
	<div class="" style="background: pink;width: 300px;height: 100px;"></div>
	<div class="" style="background: green;border: 1px solid;margin: 50px;padding: 10px">
		<div class="" style="background: red;width: 100px;height: 100px;">
		</div>
	</div>
	<div class="" style="background: pink;width: 300px;height: 100px;margin-top: 10px"></div>
</body>
</html>

效果如下: 未浮动效果
未浮动代码

<!DOCTYPE html>
<html>
<head>
	<title>css float</title>
</head>
<body>
	<div class="" style="background: pink;width: 300px;height: 100px;"></div>
	<div class="" style="background: green;border: 1px solid;margin: 50px;padding: 10px">
		<div class="" style="background: red;width: 100px;height: 100px;float: left;">
		</div>
	</div>
	<div class="" style="background: pink;width: 300px;height: 100px;margin-top: 10px"></div>
</body>
</html>

效果如下: 未浮动效果

float's People

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.