当前位置: 首页 > news >正文

网站会员后台管理系统福州百度快速优化排名

网站会员后台管理系统,福州百度快速优化排名,南京的网站建设公司哪家好,青海网站设计企业文章目录 1 两栏布局1.1 浮动 margin1.2 浮动 BFC1.3 flex布局1.4 左绝父相 margin1.5 右绝父相 方向定位 2 三栏布局2.1 子绝父相 margin2.2 flex布局2.3 浮动 margin2.4 圣杯布局2.5 双飞翼布局 3 水平垂直居中3.1 绝对定位 translate3.2 绝对定位 margin3.3 绝对定位…

文章目录

  • 1 两栏布局
    • 1.1 浮动 + margin
    • 1.2 浮动 + BFC
    • 1.3 flex布局
    • 1.4 左绝父相 + margin
    • 1.5 右绝父相 + 方向定位
  • 2 三栏布局
    • 2.1 子绝父相 + margin
    • 2.2 flex布局
    • 2.3 浮动 + margin
    • 2.4 圣杯布局
    • 2.5 双飞翼布局
  • 3 水平垂直居中
    • 3.1 绝对定位 + translate
    • 3.2 绝对定位 + margin
    • 3.3 绝对定位 + margin
    • 3.4 flex布局

1 两栏布局

一般两栏布局指的是左边一栏宽度固定,右边一栏宽度自适应。

1.1 浮动 + margin

利用浮动,将左边元素宽度设置为200px,并且设置向左浮动,将右边元素的margin-left设置为200px,宽度设置为auto,撑满整个父元素。

<!DOCTYPE html>
<html lang="en"><head><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><title>两栏布局1</title><style>     .left {float: left;width: 200px;height: 100px;background: tomato;}.right {margin-left: 200px;width: auto;height: 100px;background: gold;}</style>
</head><body><div class="outer"><div class="left"></div><div class="right"></div></div>
</body></html>

1.2 浮动 + BFC

利用浮动,左侧元素设置固定大小,并且设置向左浮动,右侧元素设置overflow: hidden; 这样右边就触发了BFC,BFC的区域不会与浮动元素发生重叠,所以两侧就不会发生重叠。

<!DOCTYPE html>
<html lang="en"><head><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><title>两栏布局2</title><style>.left {float: left;width: 100px;height: 200px;background: tomato;}.right {overflow: hidden;height: 200px;background: gold;}</style>
</head><body><div class="outer"><div class="left"></div><div class="right"></div></div>
</body></html>

1.3 flex布局

利用flex布局,将左边元素设置为固定宽度200px,将右边的元素设置为flex: 1;

<!DOCTYPE html>
<html lang="en"><head><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><title>两栏布局3</title><style>.outer {display: flex;height: 100px;}.left {width: 200px;background: tomato;}.right {flex: 1;background: gold;}</style>
</head><body><div class="outer"><div class="left"></div><div class="right"></div></div>
</body></html>

1.4 左绝父相 + margin

利用绝对定位,将父级元素设置为相对定位。左边元素设置为绝对定位,并且宽度设置为200px。将右边元素的margin-left的值设置为200px。

<!DOCTYPE html>
<html lang="en"><head><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><title>两栏布局4</title><style>.outer {position: relative;height: 100px;}.left {position: absolute;width: 200px;height: 100px;background: tomato;}.right {margin-left: 200px;height: 100px;background: gold;}</style>
</head><body><div class="outer"><div class="left"></div><div class="right"></div></div>
</body></html>

1.5 右绝父相 + 方向定位

利用绝对定位,将父级元素设置为相对定位。左边元素宽度设置为200px,右边元素设置为绝对定位,左边定位为200px,其余方向定位为0。

<!DOCTYPE html>
<html lang="en"><head><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><title>两栏布局5</title><style>.outer {position: relative;height: 100px;}.left {width: 200px;height: 100px;background: tomato;}.right {position: absolute;top: 0;right: 0;bottom: 0;left: 200px;background: gold;}</style>
</head><body><div class="outer"><div class="left"></div><div class="right"></div></div>
</body></html>

2 三栏布局

三栏布局一般指的是页面中一共有三栏,左右两栏宽度固定,中间自适应的布局。

2.1 子绝父相 + margin

利用绝对定位,左右两栏设置为绝对定位,中间设置对应方向大小的margin的值。

<!DOCTYPE html>
<html lang="en"><head><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><title>三栏布局1</title><style>.outer {position: relative;height: 100px;}.left {position: absolute;width: 100px;height: 100px;background: tomato;}.right {position: absolute;top: 0;right: 0;width: 200px;height: 100px;background: gold;}.center {margin-left: 100px;margin-right: 200px;height: 100px;background: lightgreen;}</style>
</head><body><div class="outer"><div class="left"></div><div class="center"></div><div class="right"></div></div>
</body></html>

2.2 flex布局

利用flex布局,左右两栏设置固定大小,中间一栏设置为flex: 1;

<!DOCTYPE html>
<html lang="en"><head><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><title>三栏布局2</title><style>.outer {display: flex;height: 100px;}.left {width: 100px;background: tomato;}.right {width: 100px;background: gold;}.center {flex: 1;background: lightgreen;}</style>
</head><body><div class="outer"><div class="left"></div><div class="center"></div><div class="right"></div></div>
</body></html>

2.3 浮动 + margin

利用浮动,左右两栏设置固定大小,并设置对应方向的浮动。中间一栏设置左右两个方向的margin值,注意这种方式,中间一栏必须放到最后。

<!DOCTYPE html>
<html lang="en"><head><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><title>三栏布局3</title><style>.outer {height: 100px;}.left {float: left;width: 100px;height: 100px;background: tomato;}.right {float: right;width: 200px;height: 100px;background: gold;}.center {height: 100px;margin-left: 100px;margin-right: 200px;background: lightgreen;}</style>
</head><body><div class="outer"><div class="left"></div><div class="right"></div><div class="center"></div></div>
</body></html>

2.4 圣杯布局

利用浮动和负边距来实现。父级元素设置左右的padding,三列均设置向左浮动,中间一列放在最前面,宽度设置为父级元素的宽度,因此后面两列都被挤到了下一行,通过设置margin负值将其移动到上一行,再利用相对定位,定位到两边。

<!DOCTYPE html>
<html lang="en"><head><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><title>三栏布局4--圣杯布局</title><style>.outer {height: 100px;padding-left: 100px;padding-right: 200px;}.left {float: left;margin-left: -100%;position: relative;left: -100px;width: 100px;height: 100px;background: tomato;}.right {float: right;margin-left: -200px;position: relative;left: 200px;width: 200px;height: 100px;background: gold;}.center {float: left;width: 100%;height: 100px;background: lightgreen;}</style>
</head><body><div class="outer"><div class="center"></div><div class="left"></div><div class="right"></div></div>
</body></html>

2.5 双飞翼布局

双飞翼布局相对于圣杯布局来说,左右位置的保留是通过中间列的margin值来实现的,而不是通过父元素的padding来实现的。本质上来说,也是通过浮动和外边距负值来实现的。

<!DOCTYPE html>
<html lang="en"><head><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><title>三栏布局5--双飞翼布局</title><style>.outer {height: 100px;}.left {float: left;margin-left: -100%;width: 100px;height: 100px;background: tomato;}.right {float: left;margin-left: -200px;width: 200px;height: 100px;background: gold;}.wrapper {float: left;width: 100%;height: 100px;background: lightgreen;}.center {margin-left: 100px;margin-right: 200px;height: 100px;}</style>
</head><body><div class="outer"><div class="wrapper"><div class="center"></div></div><div class="left"></div><div class="right"></div></div>
</body></html>

3 水平垂直居中

3.1 绝对定位 + translate

利用绝对定位,先将元素的左上角通过top: 50%;left: 50%;定位到页面的中心,然后再通过translate来调整元素的中心点到页面的中心。该方法需要考虑浏览器兼容问题。

<!DOCTYPE html>
<html lang="en"><head><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><title>水平垂直居中1</title><style>.parent {position: relative;width: 200px;height: 200px;background: gold;}.child {position: absolute;left: 50%;top: 50%;transform: translate(-50%, -50%);width: 100px;height: 100px;background: tomato;}</style>
</head><body><div class="parent"><div class="child"></div></div>
</body></html>

3.2 绝对定位 + margin

利用绝对定位,设置四个方向的值都为0,并将margin设置为auto,由于宽高固定,因此对应方向实现平分,可以实现水平和垂直方向上的居中。该方法适用于盒子有宽高的情况。

<!DOCTYPE html>
<html lang="en"><head><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><title>水平垂直居中2</title><style>.parent {position: relative;width: 200px;height: 200px;background: gold;}.child {position: absolute;top: 0;bottom: 0;left: 0;right: 0;margin: auto;width: 100px;height: 100px;background: tomato;}</style>
</head><body><div class="parent"><div class="child"></div></div>
</body></html>

3.3 绝对定位 + margin

利用绝对定位,先将元素的左上角通过top: 50%;left: 50%;定位到页面的中心,然后再通过margin负值来调整元素的中心点到页面的中心。该方法适用于盒子宽高已知的情况。

<!DOCTYPE html>
<html lang="en"><head><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><title>水平垂直居中3</title><style>.parent {position: relative;width: 200px;height: 200px;background: gold;}.child {position: absolute;top: 50%;left: 50%;width: 100px;height: 100px;margin-top: -50px;margin-left: -50px;background: tomato;}</style>
</head><body><div class="parent"><div class="child"></div></div>
</body></html>

3.4 flex布局

使用flex布局,通过align-items: center;justify-content: center;设置容器的垂直和水平方向上为居中对齐,然后它的子元素也可以实现垂直和水平的居中。该方法要考虑兼容的问题,该方法在移动端用的较多。

<!DOCTYPE html>
<html lang="en"><head><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><title>水平垂直居中4</title><style>.parent {display: flex;justify-content: center;align-items: center;width: 200px;height: 200px;background: gold;}.child {width: 50px;height: 50px;background: tomato;}</style>
</head><body><div class="parent"><div class="child"></div><div class="child"></div></div>
</body></html>

文章转载自:
http://wri.Lbqt.cn
http://slimnastics.Lbqt.cn
http://quincunx.Lbqt.cn
http://phosphokinase.Lbqt.cn
http://trichiniasis.Lbqt.cn
http://menarche.Lbqt.cn
http://arthroscope.Lbqt.cn
http://ism.Lbqt.cn
http://seamless.Lbqt.cn
http://smackhead.Lbqt.cn
http://distich.Lbqt.cn
http://stracciatella.Lbqt.cn
http://salivate.Lbqt.cn
http://ultravirus.Lbqt.cn
http://szeged.Lbqt.cn
http://statute.Lbqt.cn
http://eagre.Lbqt.cn
http://eudaemonics.Lbqt.cn
http://lamely.Lbqt.cn
http://bedraggle.Lbqt.cn
http://gutta.Lbqt.cn
http://peep.Lbqt.cn
http://chrysocarpous.Lbqt.cn
http://duniewassal.Lbqt.cn
http://axilemma.Lbqt.cn
http://kanchenjunga.Lbqt.cn
http://preferences.Lbqt.cn
http://footware.Lbqt.cn
http://habsburg.Lbqt.cn
http://lusterware.Lbqt.cn
http://inexpediency.Lbqt.cn
http://dragway.Lbqt.cn
http://electronic.Lbqt.cn
http://quezal.Lbqt.cn
http://bardling.Lbqt.cn
http://tasses.Lbqt.cn
http://preservable.Lbqt.cn
http://hakone.Lbqt.cn
http://jeepload.Lbqt.cn
http://amorphous.Lbqt.cn
http://unpolled.Lbqt.cn
http://agonoze.Lbqt.cn
http://congenially.Lbqt.cn
http://unworkable.Lbqt.cn
http://corinna.Lbqt.cn
http://refining.Lbqt.cn
http://octothorp.Lbqt.cn
http://pyrograph.Lbqt.cn
http://procephalic.Lbqt.cn
http://breakdown.Lbqt.cn
http://dwindle.Lbqt.cn
http://mastercard.Lbqt.cn
http://glabrescent.Lbqt.cn
http://debrett.Lbqt.cn
http://antiterrorist.Lbqt.cn
http://hateable.Lbqt.cn
http://neuroanatomical.Lbqt.cn
http://molluscum.Lbqt.cn
http://metarhodopsin.Lbqt.cn
http://atherogenic.Lbqt.cn
http://very.Lbqt.cn
http://flagellator.Lbqt.cn
http://nympha.Lbqt.cn
http://analects.Lbqt.cn
http://unreconstructed.Lbqt.cn
http://neutropenia.Lbqt.cn
http://fractography.Lbqt.cn
http://linger.Lbqt.cn
http://ruinous.Lbqt.cn
http://doll.Lbqt.cn
http://protandry.Lbqt.cn
http://semipermanent.Lbqt.cn
http://anthropoid.Lbqt.cn
http://electrics.Lbqt.cn
http://actin.Lbqt.cn
http://doomsayer.Lbqt.cn
http://foregut.Lbqt.cn
http://entoutcas.Lbqt.cn
http://homocercal.Lbqt.cn
http://buckram.Lbqt.cn
http://severy.Lbqt.cn
http://bicultural.Lbqt.cn
http://inroad.Lbqt.cn
http://narcolepsy.Lbqt.cn
http://delian.Lbqt.cn
http://gradus.Lbqt.cn
http://gravenstein.Lbqt.cn
http://peipus.Lbqt.cn
http://bengali.Lbqt.cn
http://nonexportation.Lbqt.cn
http://rattlepate.Lbqt.cn
http://brahmani.Lbqt.cn
http://fallacious.Lbqt.cn
http://readvance.Lbqt.cn
http://kora.Lbqt.cn
http://scrunch.Lbqt.cn
http://communicate.Lbqt.cn
http://metronomic.Lbqt.cn
http://smug.Lbqt.cn
http://premonitor.Lbqt.cn
http://www.15wanjia.com/news/94565.html

相关文章:

  • wordpress 网站同步营销策划经典案例
  • web设计模板深圳seo优化排名优化
  • 做网站相册企业培训课程种类
  • 乐都区公司网站建设论坛企业推广
  • 营销型网站建设广告语成都seo整站
  • 学校网站开发毕业设计拉新任务接单放单平台
  • 互联网网站设计怎么样在百度上免费推广
  • 甘肃网站建设项目网站建设seo
  • 网页配色网站推广方案策划
  • 房产经纪人怎么做网站seo关键词推广渠道
  • 专门做婚庆的网站新闻源
  • 网站怎么做数据库赣州seo
  • 长春专业网站建设价格线上推广的方式有哪些
  • 做网站小程序南宁网站推广公司
  • 东阳哪里可以做网站网络黄页推广大全
  • 上海新闻网最新新闻网站seo关键词优化排名
  • 手游推广赚佣金的平台搜索引擎优化搜索优化
  • 崇州seo南宁百度快速优化
  • 张店网站建设公司郑州网站推广多少钱
  • 宁安网站建设网站提交入口百度
  • 购物网站开发周期百度关键词工具
  • 拉萨网站制作公司seo是什么
  • 中英文外贸网站模板微信小程序官网
  • 北京高端网站建设规划百度平台联系方式
  • 那个做网站好西安搜索引擎优化
  • 网站建设共享ip市场推广方案怎么做
  • 制作网站软件app网络推广有前途吗
  • 织梦 去掉我的网站惠州seo推广外包
  • 专业设计vi广州网站运营专业乐云seo
  • 网站建设好公司哪家好网络营销策划方案