如图,咋在所有内容居中时,又在同一行有不同的内容,如:学院新闻和通知公告两个内容在同一行,请问这如何设置,仅用CSS,不用到js.
系统模块主要有:1、网站栏目可以自定义网站栏目,自定义的网站栏目可以分为两个级别层次,当然也可以只做一个层次,设置新网站栏目后编辑网站栏目的内容;默认栏目有些可以关闭和开启。2、物品展示系统与以往网站系统不同的是,该物品展示系统可以从0全部自定义物品的所有参数和信息;因为每种物品的详细参数是不一样的,如手机和笔记本参数完全不一样;可以自定义新物品的参数,然后自定义物品的次级和三级物品分类,大大实现
回复讨论(解决方案)
每个div设置宽度,然后一个左浮动(float:left),一个右浮动(float:right),就行了
你得了解一下CSS布局:
1. 默认布局(元素从左到右,从上到下排列);
2. 浮动布局(列布局)
3. 定位布局。
而要解决你提出的问题,就需要用到浮动布局:
<!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8"> <title>Document</title><style type="text/css"> /* reset */ * { padding: 0; margin: 0;} /* main */ .main {width: 600px; overflow: hidden; background-color: #f1f1f1; margin: 20px auto; } .main-left {float: left; width: 400px; background-color: green; } .main-right {float: right; width: 200px; background-color: blue; } .news { } .notice {}</style></head><body> <div class="main"> <div class="main-left"> <div class="news"> news <br> news <br> news <br> news <br> news <br> news <br> news <br> </div> </div> <div class="main-right"> <div class="notice"> notice <br> notice <br> notice <br> notice <br> notice <br> notice <br> notice <br> </div> </div> </div></body></html>










