div布局代码(div 结构布局的代码)

本文目录
div 结构布局的代码
《div class="main"》
《div class="left"》
《div》div1《/div》
《div》div2《/div》
《div》div3《/div》
《/div》
《div class="right"》
《div》div1《/div》
《div》div2《/div》
《/div》
《/div》
DIV 布局 左中右
《style type="text/css"》
body{ margin:0; padding:0;}
.Header{ height:100px; background:red;}
.Left{ float:left; width:200px; height:300px; background:yellow;}
.Right{ float:right; width:200px; height:300px; background:green;}
.Center{ margin:0 200px; height:300px; background:blue;}
.Content{ min-width:700px;_width:expression((document.documentElement.clientWidth||document.body.clientWidth)》700?"700px":"");}
《/style》
《/head》
《body》
《div class="Header"》《/div》
《div class="Content"》
《div class="Right"》右《/div》
《div class="Left"》左《/div》
《div class="Center"》中《/div》
《/div》
《/body》
div 布局代码间距相同
《html》
《head》
《style type="text/css"》
#con{
width:1000px;
height:900px;
background:#666;
display:block;
margin:0px auto;
}
#con div{
width:300px;
height:100px;
float:left;
background:#333;
display:block;
margin-top:20px;
}
.middle{
margin:0px 50px;
}
《/style》
《script language="javascript" type="text/javascript"》
function do_margin()
{
var divArr = document.getElementById("con").getElementsByTagName("div");
var i=1;
while(i《=divArr.length)
{
var j=1;
while(j《=divArr.length)
{
divArr.className = "middle";
i=i+3;
j=j+1
}
}
}
《/script》
《/head》
《body》
《div id="con" onmousemove="do_margin();"》
《div》111111《/div》
《div》111111《/div》
《div》111111《/div》
《div》111111《/div》
《div》111111《/div》
《div》111111《/div》
《div》111111《/div》
《div》111111《/div》
《div》111111《/div》
《div》111111《/div》
《div》111111《/div》
《div》111111《/div》
《div》111111《/div》
《div》111111《/div》
《div》111111《/div》
《div》111111《/div》
《div》111111《/div》
《div》111111《/div》
《div》111111《/div》
《div》111111《/div》
《div》111111《/div》
《div》111111《/div》
《div》111111《/div》
《/div》
《/body》
《/html》
此代码只适合每行排列3个块,如果每行少于3个或多于3个,那就需要重新写函数。
div布局从左到右 不用CSS代码怎么写
div本身是盒子类型标签,就是块级标签,不给css样式的话,它的宽就是父级的宽,高是根据子级内容来定的,所以你若是想把td变成div,不用css是不行的,要给div设置宽,然后设置浮动float:left;,这样才行

更多文章:
数据库管理系统和数据库系统分别侧重(数据库,数据库管理系统,数据库系统,这三个分别是什么意思并举个实例)
2026年9月7日 17:00
springmvc的依赖(springMVC的注入方式有哪几种,这与springMVC依赖)
2026年9月7日 14:00
display flex 自动换行(overflow-y:hidden;overflow-x:auto;无效解决方法)
2026年9月7日 11:00
timestamp without time zone(Postgresql中to_date()函数使用问题)
2026年9月7日 09:40








