求教div结合css布局问题_html/css_WEB-ITnose

php中文网
发布: 2016-06-24 12:21:33
原创
1098人浏览过

本帖最后由 u010856150 于 2013-05-27 16:58:45 编辑

CSS 布局 div HTML

<html><head>	<title>无标题</title>	<style type="text/css">		.hbox{			 		}		.vbox{		}	</style><body>	<div width="100%" height="100%" class="hbox">		<div width="50%" height="100%" class="vbox">			<img  src="mr.jpg"    style="max-width:90%"  style="max-width:90%"/ alt="求教div结合css布局问题_html/css_WEB-ITnose" >			<img  src="mr.jpg"    style="max-width:90%"  style="max-width:90%"/ alt="求教div结合css布局问题_html/css_WEB-ITnose" >		</div>		<div width="50%" height="100%" class="hbox">			<img  src="mr.jpg"    style="max-width:90%"  style="max-width:90%"/ alt="求教div结合css布局问题_html/css_WEB-ITnose" >			<img  src="mr.jpg"    style="max-width:90%"  style="max-width:90%"/ alt="求教div结合css布局问题_html/css_WEB-ITnose" >		</div>	</div></body></html>
登录后复制


效果是下面这种样子,首先水平布局分两栏,然后左边是垂直布局,右边是水平布局,如何写css?


回复讨论(解决方案)

补充下效果图:

<!DOCTYPE html><html>    <head>       <style>       		.content{       		width:300px;       		height:200px;       		border:solid 1px red;       		}       		.contentLeft{       		float:left;       		width:33%;       		height:100%;       		border-right:solid 1px #ccc;       		}       		.leftTop{       		width:100%;       		height:50%;       		border-bottom:solid 1px black;       		}       		.leftbottom{       		width:100%;       		height:50%;}       </style>    </head>    <body>    	<div class="content">    		<div class="contentLeft">    			<div class="leftTop"></div>    			<div class="leftbottom"></div>    		</div>    		<div class="contentLeft"></div>    		<div class="contentLeft"></div>    	</div>    </body></html>
登录后复制

可不可以只设置两个样式就完成这种效果,一个是水平的样式,一个是垂直的样式,基于我代码中的那样?

自己修改一下

<html xmlns="http://www.w3.org/1999/xhtml"><head>    <title></title>    <script src="../Res/Script/jquery-1.9.1.js"></script>    <style type="text/css">        * {        margin:0px; padding:0px;        }        .hbox {            height: 50%;            width: 100%;            float:left;        }        .vbox {            width: 50%;            height: 100%;            float:left;        }    </style></head><body>    <div width="100%" height="100%" class="hbox" style=" background:#c8f3f3">        <div width="50%" height="100%" class="vbox">            <div style="background: #808080" class="hbox" >A</div>            <div style="background: #2aac3c" class="hbox">B</div>        </div>        <div width="50%" height="100%" class="vbox">            <div style="background: #ffd800" class="vbox">C</div>            <div style="background: #ff0000"  class="vbox">D</div>        </div>    </div></body></html>
登录后复制

搞定了,谢谢qq290032431和w_mojian180!

HTML速学教程(入门课程)
HTML速学教程(入门课程)

HTML怎么学习?HTML怎么入门?HTML在哪学?HTML怎么学才快?不用担心,这里为大家提供了HTML速学教程(入门课程),有需要的小伙伴保存下载就能学习啦!

下载
来源:php中文网
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn
最新问题
开源免费商场系统广告
热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
关于我们 免责申明 举报中心 意见反馈 讲师合作 广告合作 最新更新 English
php中文网:公益在线php培训,帮助PHP学习者快速成长!
关注服务号 技术交流群
PHP中文网订阅号
每天精选资源文章推送
PHP中文网APP
随时随地碎片化学习

Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号