当前位置:   article > 正文

使用html+css完成仿站操作要点_仿站咋把前端修改

仿站咋把前端修改

今天是重新学习html5+css3的第一天,主要内容为照已有网站图片进行搭建。

因为有基础,代码后的要点是根据我自身不足列下的,如果缺漏,欢迎指出

<!DOCTYPE html>
<html>
 <head>
  <meta charset="utf-8">
  <title></title>
  
 </head>
 <style type="text/css">
 *{margin: 0;padding: 0;}
  .header{
   width: 100%;
   height: 489px;
   background-color: red;
  }
  .header_top{
    width: 100%;
    height: 142px;
    background-color: black;
  }
  .header_top .inner{
    width: 994px;
    height: 142px;
/*    background-color: red;*/
    margin:0 auto;
  }
  .header_top .inner .logo{
    width: 451px;
    height: 142px;
    background-color: blue;
    float:left;
  }
  .header_top .inner h1{
    width: 451px;
    height: 142px;
    background-image: url(images/logo_02.png);

  }
  .header_top .inner h1 a{
    display: block;
    width: 451px;
    height: 142px;
    text-indent: -1000px;
  }
  .header_top .inner .nav{
    width: 480px;
    height: 142px;
    float: right;
  }
  .header_top .inner .nav ul li{
    height: 142px;
    list-style: none;
    float:left;
    font-size: 12px;
    line-height: 142px;
    margin-right: 29px;
  }
  .header_top .inner .nav ul li a{
    text-decoration: none;
    color:#7f7f7f;
  }
  .header_top .inner .nav ul li .active{
    color:#cb2700;
  }
  .header_bot{
    width: 100%;
    height: 349px;
    background-image: url(images/header_bot_bg_02.png);
  }
  .header_bot .inner{
    width: 966px;
    height: 283px;
    /*background-color: red;*/
    margin:0 auto;
    /* 容器和内容之间的间距 加了padding后 增加了网页中实际占位,故减少自身*/
    padding-top: 65px;
    padding-left: 29px;
    position: relative;
  }
   .header_bot .inner h3{
      color:white;
      font-size: 24px;
      margin-bottom: 17px;
   }
  .header_bot .inner p{
    width: 588px;
    color: #7f7f7f;
    line-height: 25px;
    margin-bottom: 21px;
  }
  .header_bot .inner p a{
    color:#cb2800;
  }
  .header_bot .inner .more{
    /*因为是按钮 得让a标签变为块元素*/
      display: block;
      width: 106px;
      height: 41px;
      background-image: url(images/more_bg_03.png);
      color:white;
      text-decoration: none;
      line-height: 41px;
      text-align: center;
      font-size: 20px;
      border-radius:4px;
   }
  .header_bot .inner img{
    position: absolute;
    left:654px;
    top:-33px;
  }
  .main{
     width: 100%;
     height: 897px;
     background-image: url(images/main_bg_02.png);
  }
  .main .inner{
    width: 940px;
    height: 856px;
    margin:0 auto;
    background-color: blue;
    padding-left: 33px;
    padding-top: 41px;
    padding-right:25px;
  }
  .main .inner .top{
    width: 940px;
    height: 180px;
    /*background-color: green;*/
  }
  .main .inner .top a:not(:first-child){
    width: 300px;
    height: 180px;
    margin-left:15px;
  }
  .main .inner .top a img{
    width: 300px;
    height: 180px;
  }
 .main .inner .left{
    width: 620px;
    height: 676px;
    background-color: orange;
    float:left;
  }
 .main .inner .right{
    width: 300px;
    height: 676px;
    background-color: yellow;
    float:right;
  }
  .footer{
   width: 100%;
   height: 125px;
   background-color: black;
  }
  
 </style>
 <body>
  <div class="header">
    <div class="header_top">
      <div class="inner">
          <div class="logo">
            <h1><a href="index.html">EaglesTroop</a></h1>
          </div>
          <div class="nav">
            <ul>
              <li><a href="" class="active">About</a></li>
              <li><a href="">Foundation</a></li>
              <li><a href="">Program</a></li>
              <li><a href="">Leaders</a></li>
              <li><a href="">Gallery</a></li>
              <li><a href="">Contacts</a></li>
            </ul>
          </div>
      </div>
    </div>
    <div class="header_bot">
      <div class="inner">
        <h3>Welcome to Eagles Boy Scount Troops!</h3>
        <p>Welcome to Eagles <a href="">Boy Scount Troops!Welcome to</a> Eagles Boy Scount Troops!Welcome to Eagles Boy Scount Troops <a href="">!Welcome to Eagles Boy Scount Troops!</a>Welcome to Eagles Boy Scount Troops!Welcome to Eagles Boy Scount Troops!Welcome to Eagles Boy Scount Troops!</p>
        <a href="#" class="more">more</a>
        <img src="images/mz_03.png" alt="">
      </div>
    </div>

  </div>
  <div class="main">
    <div class="inner">
      <div class="top">
        <a href=""><img src="images/top_bg_01.png" alt=""></a>
        <a href=""><img src="images/top_bg_02.png" alt=""></a>
        <a href=""><img src="images/top_bg_03.png" alt=""></a>
      </div>
      <div class="left">
        
      </div>
      <div class="right">
        
      </div>
    </div>
  </div>
  <div class="footer"></div>
 </body>
</html>
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65
  • 66
  • 67
  • 68
  • 69
  • 70
  • 71
  • 72
  • 73
  • 74
  • 75
  • 76
  • 77
  • 78
  • 79
  • 80
  • 81
  • 82
  • 83
  • 84
  • 85
  • 86
  • 87
  • 88
  • 89
  • 90
  • 91
  • 92
  • 93
  • 94
  • 95
  • 96
  • 97
  • 98
  • 99
  • 100
  • 101
  • 102
  • 103
  • 104
  • 105
  • 106
  • 107
  • 108
  • 109
  • 110
  • 111
  • 112
  • 113
  • 114
  • 115
  • 116
  • 117
  • 118
  • 119
  • 120
  • 121
  • 122
  • 123
  • 124
  • 125
  • 126
  • 127
  • 128
  • 129
  • 130
  • 131
  • 132
  • 133
  • 134
  • 135
  • 136
  • 137
  • 138
  • 139
  • 140
  • 141
  • 142
  • 143
  • 144
  • 145
  • 146
  • 147
  • 148
  • 149
  • 150
  • 151
  • 152
  • 153
  • 154
  • 155
  • 156
  • 157
  • 158
  • 159
  • 160
  • 161
  • 162
  • 163
  • 164
  • 165
  • 166
  • 167
  • 168
  • 169
  • 170
  • 171
  • 172
  • 173
  • 174
  • 175
  • 176
  • 177
  • 178
  • 179
  • 180
  • 181
  • 182
  • 183
  • 184
  • 185
  • 186
  • 187
  • 188
  • 189
  • 190
  • 191
  • 192
  • 193
  • 194
  • 195
  • 196
  • 197
  • 198
  • 199
  • 200
  • 201
  • 202
  • 203
  • 204
要点1:为了保证统一,css第一句给所有标签设置间距和内间距为0;
要点2:页面logo用h5标签内嵌a标签,h5标签为了网站更好的索引,text-indent:-1000px; 直接将a标签中的内容移走 ,使页面不出现多余的文字而能高效检索。
要点3:margin在使用时 用上面的标签 margin-bottom 即向下挤,使页面再不同分辨率也能保持不乱。
要点4:设置padding后,增加了网页中实际占位,需减少本标签的width或height。
要点5:新学习了用ps中的标尺与切片操作可以更好的把握页面的精准像素,减少误差。
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/小舞很执着/article/detail/980185
推荐阅读
相关标签
  

闽ICP备14008679号