css页面练习

1、代码 

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Document</title>
  <link rel="stylesheet" href="../download/font_4160017_19senzoyymj/iconfont.css">
  <style>
    *{
      margin: 0;
      padding: 0;
    }
    .bg{
      width: 1000px;
      height: 600px;
      background-color:rgb(253, 253, 253);
      display: flex;
      flex-wrap: wrap;
      margin: 0 auto;
      padding: 10px;
    }
    .top{
      width: 1000px;
      height: 100px;
      display: flex;
      justify-content: space-between;
    }
    div .mi{
      width: 80px;
      height: 70px;
      background-color:rgb(231, 93, 13);
      font-size: 45px;
      border-radius: 45%;
      color:white;
    }
    div .center{
      display: flex;
      width: 700px;
      height: 70px;
      /* background-color: aquamarine; */
      justify-content: center;
      align-items: center;
    }
    .center li{
      display: inline-block;
      /* background-color: aliceblue; */
      list-style: none;
    }
    .center li:hover{
      color: orange;
    }
    .sousuo{
      width: 300px;
      height: 70px;
      /* background-color: bisque; */
      position: relative;
    }
    .sousuo input[type="text"]{
      width: 200px;
      height: 50px;
      position: absolute;
      right: 0;
      /* position: relative; */
    }
    .sousuo .iconfont{
      font-size: 50px;
      position: absolute;
      right: 0;
    }
    .sousuo span{
      width: 50px;
      height: 50px;
      border-width: 1px;
      border-style: solid;
      border-color: black;
    }
    .sousuo span:hover{
      background-color: orange;
    }
    .left{
      width: 200px;
      height: 500px;
      background-color: rgb(135, 138, 137);
      display: flex;
      align-content: space-between;
    }
    .left li{
      position: relative;
      display: inline-block;
      width: 200px;
      height: 50px;
      /* background-color: aliceblue; */
      list-style: none;
      text-align:left;
      text-indent: 2em;
      line-height: 50px;
    }
    .left li:hover{
      background-color: orange;
    }
    .left .iconfont{
      position: absolute;
      right: 10px;
    }
    .right{
      width: 800px;
      height: 500px;
      background-color: rgb(233, 233, 233);
      position: relative;
    }
    .right .iconfont:nth-of-type(1){
      font-size: 50px;
      position: absolute;
      top: 200px;
    }
    .right span:nth-of-type(1){
      width: 50px;
      height: 50px;
    }
    .right span:nth-of-type(1):hover{
      background-color:rgb(158, 159, 160);
    }
    .right .iconfont:nth-of-type(2){
      font-size: 50px;
      position: absolute;
      top: 200px;
      right: 0;
    }
    .right span:nth-of-type(2){
      width: 50px;
      height: 50px;
    }
    .right span:nth-of-type(2):hover{
      background-color:rgb(158, 159, 160);
    }
    .right span:nth-of-type(3){
      position: absolute;
      bottom: 30px;
      right: 140px;
    }
    /* .right span:nth-of-type(3):hover{
      background-color:lightsteelblue;
    } */
    .right span:nth-of-type(4){
      position: absolute;
      bottom: 30px;
      right: 120px;
    }
    .right span:nth-of-type(5){
      position: absolute;
      bottom: 30px;
      right: 100px;
    }
  </style>
</head>
<body>
  <div class="bg">
    <div class="top">
      <div class="mi">MI</div>
      <div class="center">
        <ul>
          <li>Xiaomi手机</li>
          <li>Redmi手机</li>
          <li>电视</li>
          <li>笔记本</li>
          <li>平板</li>
          <li>家电</li>
          <li>路由器</li>
          <li>服务中心</li>
          <li>社区</li>
        </ul>
      </div >
      <div class="sousuo"><input type="text">
        <span class="iconfont icon-sousuo"></span>
      </div>
    </div>
    <div class="left">
      <ul>
          <li class="goods">手机
              <span class="iconfont icon-arrow-right-bold"></span>
          </li>
          <li class="goods">电视
              <span class="iconfont icon-arrow-right-bold"></span>
          </li>
          <li class="goods">家电
              <span class="iconfont icon-arrow-right-bold"></span>
          </li>
          <li class="goods">笔记本 平板
              <span class="iconfont icon-arrow-right-bold"></span>
          </li>
          <li class="goods">出行 穿戴
              <span class="iconfont icon-arrow-right-bold"></span>
          </li>
          <li class="goods">耳机 音响
              <span class="iconfont icon-arrow-right-bold"></span>
          </li>
          <li class="goods">健康 儿童
              <span class="iconfont icon-arrow-right-bold"></span>
          </li>
          <li class="goods">生活 箱包
              <span class="iconfont icon-arrow-right-bold"></span>
          </li>
          <li class="goods">智能 路由器
              <span class="iconfont icon-arrow-right-bold"></span>
          </li>
          <li class="goods">电源 配件
              <span class="iconfont icon-arrow-right-bold"></span>
          </li>
      </ul>
    </div>
    <div class="right">
        <span class="iconfont icon-arrow-left-bold"></span>
        <span class="iconfont icon-arrow-right-bold"></span>
        <span class="iconfont icon-shixinxiaoyuanquan"></span>
        <span class="iconfont icon-shixinxiaoyuanquan"></span>
        <span class="iconfont icon-shixinxiaoyuanquan"></span>
    </div>
  </div>
</body>
</html>

2、运行页面

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
CSS移动端布局练习是用于设计和开发适应移动设备的网页的练习。移动设备的屏幕尺寸较小,需要针对不同尺寸的设备进行响应式布局,以保证页面在不同设备上的显示效果和用户体验。 在进行CSS移动端布局练习时,需要注意以下几点: 1. 使用媒体查询:媒体查询是CSS中的一种技术,它可以根据设备的屏幕尺寸和其他特性来调整页面的布局和样式。我们可以使用@media规则来设置不同屏幕尺寸的样式,以实现响应式布局。 2. 弹性盒子布局:弹性盒子布局(Flexbox)是CSS中一种用于创建灵活的、自适应的布局的技术。它可以使元素在容器内自动调整大小和位置,适应不同尺寸的屏幕。使用弹性盒子布局可以更方便地实现移动端页面的布局。 3. 隐藏不必要的元素:在移动端页面中,由于屏幕尺寸有限,可能需要隐藏一些不必要的元素,以提升页面的加载速度和用户体验。可以使用CSS的display属性来隐藏或显示元素。 4. 触摸事件:移动设备上常用的交互方式是通过触摸屏幕来实现的。在移动端布局练习中,可以利用CSS的伪类选择器(:hover)和触摸事件来添加交互效果,如改变按钮的背景颜色或是显示隐藏的菜单等。 通过不断练习和实践,可以提高在移动端布局方面的能力和经验,更好地适应移动设备的页面设计和开发工作。同时,学习和了解最新的CSS技术和移动端设计趋势也是很重要的,以便在实践中使用到新的技术和方法。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值