首页 > 解决方案 > 我的个人资料页面不适用于使用引导 css 和 html 的手机屏幕

问题描述

嗨,我想用 css html 和 bootstrap 3 制作个人资料页面,我的问题是这个页面不适合手机,我很抱歉,因为我在 bootstrap 中跟随初学者。profile-nav我也想排成一行。你可以在这里查看https://www.aswaktinghir.ma/users

    html {
  font-family: "proxima-nova",sans-serif;
}

/* apply a natural box layout model to all elements */
*, *:before, *:after {
  -moz-box-sizing: border-box;
  -webkit-box-sizing: border-box;
  box-sizing: border-box;
}

html, html a {
  -webkit-font-smoothing: antialiased !important;
  text-shadow: 1px 1px 1px rgba(0, 0, 0, 0.004);
}

a {
  text-decoration: none;
  color: inherit;
}

/* ==== */
.site-header {
  height: 44px;
  width: 100%;
  border-bottom: 1px solid #E1e1e1;
}

.cover-photo {
  width: 980px;
  height: 250px;
  margin: 0 auto;
  background-color: #f5f5f5;
  position: relative;
  z-index: 1;  
}

.body {
  width: 980px;
  margin: 0 auto;
  z-index: 4;
  position: relative;
}

.left-col, .right-col {
  width: 226px;
  float: left;
  min-height: 400px;
  position: relative;
}

.left-col {
  margin-right: 24px;
  position: relative;
  top: -150px;
  left: 8px;
}

.center-col {
  float: left;
  width: 480px;
  margin-right: 24px;
  min-height: 400px;
}

.right-col {
  background-color: blue;
}

/* LEFT COL */
.user-info h1 {
  font-size: 24px;
  font-weight: 600;
  line-height: 1.2;
  padding-top: 4px;
}
.user-info h2 {
  color: #666;
  font-size: 16px;
}
.user-info .meta {
  padding: 8px 0;
  font-size: 14px;
}
.user-info .meta p {
  line-height: 1.6;
}
.user-info .meta i {
  font-size: 0.95em;
  padding-right: 2px;
}

.profile-avatar {
  width: 218px;
  height: 218px;
  border: 1px solid #e1e1e1;
  background-color: #fff;
  right: 0;
}
.profile-avatar .inner {
  width: 206px;
  height: 206px;
  margin: 5px;
  
}

/* CENTER */
.image-grid {
  width: 100%;
}
.image-grid li {
  float: left;
  background-color: #EFEFEF;
}
.image-grid.col-31 li {
  width: 32%;
  margin-right: 2%;
  margin-bottom: 2%;
  height: 0;
  padding-bottom: 30%;
  -webkit-background-size: 100%;
  background-size: 100%;
}
.image-grid.col-31 li:nth-child(3n) {
  margin-right: 0;
}
.image-grid.col-3 li {
  width: 32%;
  margin-right: 2%;
  margin-bottom: 2%;
  height: 0;
  padding-bottom: 30%;
  
  -webkit-background-size: 100%;
  background-size: 100%;
}
.image-grid.col-3 li:nth-child(3n) {
  margin-right: 0;
}
.profile-nav {
  height: 46px;
  background-color: white;
  border-bottom: 2px solid #E1E1E1;
  margin-bottom: 8px;
}
.profile-nav ul > li {
  color: #999;
  font-size: 14px;
  float: left;
  line-height: 44px;
  font-weight: 600;
  padding: 0 22px;
  cursor: pointer;
}
.profile-nav li.active {
  color: #1E1E1E;
}

.content .unit {
  padding: 8px 0 10px 0;
  border-bottom: 2px solid #E1E1E1;
  margin-bottom: 8px;
}
.content .unit:last-child {
  margin-bottom: 16px;
}
.content .unit h3 {
  margin-bottom: 4px;
  color: #777;
}
.content .unit h3 a {
  color: #1e1e1e;
  font-weight: 600;
}
.content .unit p.time {
  color: #777;
  font-size: 14px;
  margin-bottom: 8px;
}
.content .unit .more {
  font-size: 14px;
  color: #777;
}
.content .unit .more a {
  color: #777;
}
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">

    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">

    <title>Document</title>
</head>
<body>

<div class="page-content">

   <header class="site-header"></header>

   <div class="col-md-12">
     <div class="cover-photo" style="background-image: url('gallery/not-found.jpg')"></div>
   </div>
   
   <div class="col-md-12">
   <div class="body">
      <section class="left-col user-info">
            <div class="profile-avatar">
              <div class="inner" style="background-image: url('gallery/not-found.jpg')">
              </div>
            </div>
            <h1>MARZOUK NAJIB</h1>
            <h2>A propos</h2> 
            <div class="meta">
              <p><i class="fa fa-fw fa-map-marker"></i>Tinghir (tihit [tihit soufla])</p>
              <p><i class="fa fa-fw fa-link"></i>hay tihit tinghir</p>
              <p><i class="fa fa-fw fa-link"></i>mansour tihit tinghir</p>
              <p><i class="fa fa-fw fa-clock-o"></i> Joined Dec 26, 2008</p>
            </div>
      </section>
    </div>
    
    <div class="col-md-12">
     <section class="section center-col content">
        <nav class="profile-nav">
          <ul>
            <li>convert image</li>
            <li>Profile image</li>
            <li>my propre image</li>
            <li>my informations</li>
          </ul>
        </nav>
     </section>
    </div>
    
    
     <section class="right-col">
     </section>
    
    
   </div>

</div>
</body>
</html>

标签: htmlcsstwitter-bootstrap

解决方案


你在 CSS 类中有这样的错误,fe 'col-md 12' 需要是 'col-md-12' 等等。您还需要注意您的列结构。

为了理解 Bootstrap CSS - 你可以阅读非最小化的 CSS 并找到他们需要的类。


推荐阅读