前端设计,box-sizing 理解,float:left与margin-left配合


<head>
  <meta http-equiv="content-type" content="text/html;charset=utf-8" />
  <meta name="format-detection" content="telephone=no" />
  <meta name="format-detection" content="email=no" />
  <title></title>
  <meta name="description" content="">
  <meta name="keywords" content="">
  <style>
    *{
      margin: 0;
      padding: 0;
      box-sizing: border-box;
    }
    .l-wrapper{
      max-width: 1200px;
      min-width: 960px;
      margin-right: auto;
      margin-left: auto;
      margin-top: 30px;
    }
    body{
      line-height: 1.5;
      font-size: 14px;
    }
    ._clearfix:after,._clearfix:before{
      content:" ";
      display:table;
    }
    ._clearfix:after{
      clear:both;
    }
    .myPanel{
      overflow: hidden;
    }
    
    .myPanel_side{
      float: left;
      width: 25%;
    }
    
    .myPanel_main{
      margin-left: 25%; /* 此处如果不写margin-left:25%会导致右边元素显示不正确*/
    }
    .myMenu{
      border: 1px solid #e0e0e0;
      border-bottom: 0;
    }
    .myMenu>li{
      display: block;
      line-height: 45px;
      border-bottom: 1px solid #e0e0e0;
      padding: 0 20px;
    }
    .myMenu>li>a{
      color: #333;
      font-size: 18px;
      text-decoration: none;
      display: block;
      white-space: nowrap;
      overflow: hidden;
      text-overflow:ellipsis;
    }
    .myForm_left{
      float: left;
      width: 60%;
      padding: 0 20px;
    }
    .myForm_right{
      float: right;
      width: 40%;
      padding: 0 10px;
    }
    .myForm_grp{
      line-height: 40px;
    }
    .myForm_table table{
      width: 100%;
    }
    .myForm_table table>tbody>tr>td{
      line-height: 46px;
      padding: 0 8px;
    }
    .myForm_table table>tbody>tr>td.is-tit{
      white-space: nowrap;
      text-align: right;
      width: 1px;
    }
    .myForm_rads{
      margin-bottom: 15px;
    }
    .myForm_rads>label{
      display: block;
      line-height: 45px;
      border-bottom: 1px dashed #eee;
    }
    .myForm_rads>label>input{
      vertical-align: middle;
    }
    .myForm_rads>label>span{
      vertical-align: middle;
    }
    .form_control{
      border: 1px solid #e0e0e0;
      border-radius: 4px;
      width: 100%;
      padding: 5px 12px;
      font-size: 14px;
      line-height: 1.42857;
      color: #555555;
      background-color: #fff;
      background-image: none;
      border: 1px solid #ccc;
    }
  </style>
</head>

<body>
  <div class="l-wrapper">
    <div class="myPanel">
      <div class="myPanel_side">
        <ul class="myMenu">
          <li>
            <a href="javascript: void(0);" οnclick="steelFirstLevelClick(1)">重型</a>
          </li>
          <li>
            <a href="javascript: void(0);"  οnclick="steelFirstLevelClick(2)">中型</a>
          </li>
          <li>
            <a href="javascript: void(0);">版型</a>
          </li>
          <li>
            <a href="javascript: void(0);">炉料</a>
          </li>
          <li>
            <a href="javascript: void(0);">纯净废钢</a>
          </li>
          <li>
            <a href="javascript: void(0);">冲压料</a>
          </li>
          <li>
            <a href="javascript: void(0);">打包压块</a>
          </li>
        </ul>
      </div>
      <div class="myPanel_main">
        <div class="myForm _clearfix">
          <div class="myForm_left">
            <div class="myForm_table">
              <table>
                <tr>
                  <td class="is-tit">&nbsp;</td>
                  <td>
                    <select class="form_control" name="field1">
                      <option value="1">选项一</option>
                      <option value="2">选项二</option>
                      <option selected value="3">选项三</option>
                      <option value="4">选项四</option>
                      <option value="5">选项五</option>
                      <option value="6">选项六</option>
                    </select>
                  </td>
                </tr>
                <tr>
                  <td class="is-tit">参数1</td>
                  <td><input class="form_control" name="param1" placeholder="请输入" type="text" /></td>
                </tr>
                <tr>
                  <td class="is-tit">参数2</td>
                  <td><input class="form_control" name="param2" placeholder="请输入" type="text" /></td>
                </tr>
                <tr>
                  <td class="is-tit">参数3</td>
                  <td><input class="form_control" name="param3" placeholder="请输入" type="text" /></td>
                </tr>
              </table>
            </div>
          </div>
          <div class="myForm_right">
            <div class="myForm_rads">
              <label>
                <input name="test" type="radio" />
                <span>单选1</span>
              </label>
              <label>
                <input name="test" type="radio" />
                <span>单选2</span>
              </label>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</body>
<script>

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
帮我优化以下代码<style> * { box-sizing: border-box; } .row::after { content: ""; clear: both; display: table; } [class*="col-"] { float: left; padding: 15px; } html { font-family: "Lucida Sans", sans-serif; } .header { background-color: #0603F7; color: #ffffff; padding: 3px; } .menu ul { list-style-type: none; margin: 0; padding: 0; } .menu li { padding: 8px; margin-bottom: 7px; background-color: #33b5e5; color: #ffffff; box-shadow: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.24); } .menu li:hover { background-color: #F59B06; } .aside { background-color: #33b5e5; padding: 15px; color: #ffffff; text-align: center; font-size: 14px; box-shadow: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.24); } .footer { background-color: #0099cc; color: #ffffff; text-align: center; font-size: 12px; padding: 15px; } /* For mobile phones: */ [class*="col-"] { width: 100%; } @media only screen and (min-width: 600px) { /*小屏幕 */ .col-s-1 {width: 8.33%;} .col-s-2 {width: 16.66%;} .col-s-3 {width: 100%;} .col-s-4 {width: 33.33%;} .col-s-5 {width: 41.66%;} .col-s-6 {width: 75%;} .col-s-7 {width: 58.33%;} .col-s-8 {width: 66.66%;} .col-s-9 {width: 100%;} .col-s-10 {width: 83.33%;} .col-s-11 {width: 91.66%;} .col-s-12 {width: 100%;} } @media only screen and (min-width: 768px) { /*大屏幕*/ .col-1 {width: 8.33%;} .col-2 {width: 16.66%;} .col-3 {width: 100%;} .col-4 {width: 33.33%;} .col-5 {width: 41.66%;} .col-6 {width: 100%;} .col-7 {width: 58.33%;} .col-8 {width: 66.66%;} .col-9 {width: 75%;} .col-10 {width: 83.33%;} .col-11 {width: 91.66%;} .col-12 {width: 100%;} } </style>
最新发布
05-30

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值