jquery - 使我的网站的某些部分更具移动性和不同的屏幕分辨率大小友好

标签 jquery html css bootstrap-4 responsive-design

我的问题如下,我截取了我正在处理的简历网站的一部分,大多数内容都适合移动设备调整大小。使用预期的 Bootstrap 。我知道我在这方面不是最擅长的,并且正在寻找一种方法来优化以下代码部分,使其更适合移动和不同的屏幕尺寸。

除最右侧的日期和最右侧的位置外,所有内容似乎都适合移动设备调整大小。它似乎会根据屏幕大小四处移动并跳转到不同的行。

有任何提示或解决方案吗?我的代码的其他部分可能有更好的方法吗?

JSFiddle:https://jsfiddle.net/j49725p3/

html{
        background-color: White;
        scroll-behavior: smooth;
    }
    
    ul {
        list-style: none;
    }
    
    .lipad:before{ content:"• "; font-size:12pt; }
    
    #name {
        font-size: 42px;
        font-family: 'Roboto', sans-serif;
        font-weight: 200;
        color: #373737;
    }
    
    .posi {
        font-size: 12px;
        font-family: 'Source Sans Pro', sans-serif;
        font-weight: 400;
        color: red;
        display: block;
        text-align: center;
    }
    
    .bold {
        font-size: 42px;
        font-family: 'Roboto', sans-serif;
        font-weight: 600;
        color: #373737;
    }
    
    .continf {
        font-family: 'Roboto', sans-serif;
        font-size: 12px;
        text-decoration: none!important;
        color: #373737;
        font-weight: 400;
    }
    
    .qut {
        font-family: 'Source Sans Pro', sans-serif;
        font-weight: 400;
        font-style: italic;
        color: #373737;
    }
    
    .mains {
        font-family: 'Source Sans Pro', sans-serif;
        font-weight: 700;
        font-size: 24px;
        color: red;
        overflow: hidden;
    }
    
    .mains:after {
        content:"";
        display: inline-block;
        height: 0.3em;
        vertical-align: bottom;
        width: 100%;
        margin-right: -100%;
        margin-left: 10px;
        border-top: 1px solid black;
    }
    
    .blk {
        color: #373737;
        font-family: 'Source Sans Pro', sans-serif;
        font-weight: 700;
        font-size: 24px;
    }
    
    .subhead {
        font-family: 'Source Sans Pro', sans-serif;
        font-weight: 700;
        color: #373737;
        margin-bottom: 0;
    }
    
    .subtext {
        font-size: 12px;
        font-family: 'Source Sans Pro', sans-serif;
        font-weight: 400;
        color: #686868;
        margin-bottom: 1px;
    }
    
    .loca {
        padding-left: 78%;
        font-style: italic;
        font-size: 14px;
        font-family: 'Source Sans Pro', sans-serif;
        font-weight: 300;
        color: red;
        padding-bottom: 0;
    }
    
    .date {
        padding-left: 63.4%;
        padding-top: 0;
        color: #686868;
        font-family: 'Source Sans Pro', sans-serif;
        font-weight: 300;
        padding-right: 20px;
    }
<!doctype html>
    <html lang="en">
       <head>
          <!-- Required meta tags -->
          <meta charset="utf-8">
          <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
          <!-- Bootstrap CSS -->
          <script src="jquery-2.1.4.js"></script>
          <script src="jquery-3.4.1.min.js"></script>
          <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
          <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
          <link rel="stylesheet" type="text/css" href="css/style.css">
          <link href="https://fonts.googleapis.com/css?family=Roboto:100,300,400,500,700,900|Source+Sans+Pro:200,300,400,700&display=swap" rel="stylesheet">
          <link href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:600&display=swap" rel="stylesheet">
          <script src="https://kit.fontawesome.com/26f7ef2ebf.js"></script>
          <script src="https://code.jquery.com/jquery-3.4.1.js"></script>
          <script type="text/javascript">
            $(window).on('load',function(){
              $('.preloader').addClass('complete')
            })
          </script>
          <script>
    var isVisible = false;
    $(window).scroll(function(){
         var shouldBeVisible = $(window).scrollTop()>200;
         if (shouldBeVisible && !isVisible) {
              isVisible = true;
              $('.gotop').show();
         } else if (isVisible && !shouldBeVisible) {
              isVisible = false;
              $('.gotop').hide();
        }
    });
            </script>
          <title>Joseph Kuzera | Resume</title>
       </head>
       <body>
          <section class="my-5">
              <!-- Section heading -->
      <p class="text-center h1-responsive my-5 qut">“With hard work and dedication, anything is possible.”
      </p>
      <!-- Section description -->
      <h2 class="lead grey-text w-50 mx-auto mains">Edu<span class="blk">cation</span></h2>
      <div class="container b-0 p-0 w-50"><p class="subhead">College Of Dupage <span class="loca">Glen Ellyn, IL</span></p>
       <p class="subtext">A.A.S. IN COMPUTER INFORMATION SYSTEMS <span class="date">August 2015-August 2018</span></p>
       <ul class="entry-content extra">
          <li class="lipad">Was always in good standing maintaining a GPA of 3.5 or above.</li>
       </ul>
    </div>
    </section>
    </body>
    </html>


最佳答案

您可以使用媒体查询并针对不同的屏幕尺寸为每个组件定义样式。看下面的例子:

column class has width 25%

但是当屏幕宽度小于600px时

column class has width 100%

阅读更多 https://www.w3schools.com/css/css3_mediaqueries_ex.asp

/* Create four equal columns that floats next to each other */
 .column {
       float: left;
       width: 25%;
 }

/* On screens that are 992px wide or less, go from four columns to two columns */
@media screen and (max-width: 992px) {
  .column {
    width: 50%;
  }
}

/* On screens that are 600px wide or less, make the columns stack on top of each other instead of next to each other */
@media screen and (max-width: 600px) {
  .column {
    width: 100%;
  }
}

关于jquery - 使我的网站的某些部分更具移动性和不同的屏幕分辨率大小友好,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57667897/

相关文章:

javascript - 奇怪的 jquery 动画行为

Jquery 切换 .css

javascript - 移动 HTML5 应用程序本地存储

html - 什么时候可以使用 Id 进行样式设置?

javascript - 如何在 PUT 后使用一次性消息进行重定向

javascript - Bootstrap 导航栏(左侧菜单)未在顶部正确对齐

html - 我似乎无法获得背景图像以在 css 中呈现任何内容

javascript - 如何更改 javascript 中的宽度属性?

javascript - 为什么我使用 JQuery 只获取文本而不是 HTML?

html - 如何将整个表格单元格变成 HTML/CSS 中的链接?