展会信息港展会大全

如何让父容器自动适应高度 android软件开发教程
来源:互联网   发布日期:2016-03-25 16:04:04   浏览:1519次  

导读:第一种是 代码如下 复制代码 div id=main style=display:inline-block;height:auto;background-color:#006699 !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd html xmlns=http://ww...

第一种是

代码如下

复制代码

<div id="main" style="display:inline-block;height:auto;background-color:#006699">

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />

<title>无标题文档</title>

</head>

<body>

<div id="main" style="background-color:#006699;float:left;">

<div id="a" style="width:200px; height:300px; background-color:#006666; float:left"></div>

<div id="b" style="width:700px; height:550px; background-color:#009999;float:left"></div>

</div>

</body>

</html>

第二种方法就是clear:bothi清除浮动

代码如下

复制代码

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />

<title>无标题文档</title>

</head>

<body>

<div id="main" style="background-color:#006699">

<div id="a" style="width:200px; height:300px; background-color:#006666; float:left"></div>

<div id="b" style="width:700px; height:250px; background-color:#009999;float:left"></div>

<div style="clear:both"></div>

</div>

</body>

</html>

赞助本站

人工智能实验室

相关热词: 开发 编程 android

AiLab云推荐
推荐内容
展开

热门栏目HotCates

Copyright © 2010-2024 AiLab Team. 人工智能实验室 版权所有    关于我们 | 联系我们 | 广告服务 | 公司动态 | 免责声明 | 隐私条款 | 工作机会 | 展会港