左侧图片 右侧块的实现方法---解决3像素bug的一种解决方案,不用浮动用绝对定位和margin-left...

本文解析了谷歌首页的布局实现方式,使用HTML与CSS技术将logo置于左上角,并通过绝对定位实现。同时介绍了如何设置右边搜索框的间距。

google的实现方式是:

<div class="mw">

  <a href="/" id="mlogo">  </a>

  <div id="tsfi" style="zoom:1"></div>

</div>

图片可以作为a标签的背景或者嵌套子a标签里面,为a标签设置绝对定位,右面搜索框为正常块,为右面的搜索框设置margin-left即可

具体如下,也可直接去看google搜索页

.mw{

  max-width:100%;

}

@media only screen and (-webkit-min-device-pixel-ratio: 2), only screen and (min-resolution: 192dpi)
 
#mlogo  {

  background-imageurl(/images/logo_mobile_srp_highres_3.png);

}
#mlogo  {
  backgroundurl(/images/logo_mobile_srp_3.png) no-repeat;
  background-size75px 26px;
  colortransparent;
  width75px;
  height26px;
  left9px;
  positionabsolute;
  text-aligncenter;
  top8px;
}
#tsfi  {
  margin-left102px;
  -webkit-transitionall .15s;
}

转载于:https://www.cnblogs.com/mabelstyle/p/3750341.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值