微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

在Bootstrap 4中以平板电脑大小截取文本的列

如何解决在Bootstrap 4中以平板电脑大小截取文本的列

我不确定这是一个愚蠢的问题,也许我的大脑已经爆炸了。我的网站上有联系部分。由于某种原因,它的最后一项是削减平板电脑的尺寸,而我看到要解决的唯一方法是更改​​每个部分的列数,这是我从col-md-3更改为col-md- 4,但这不是我真正想要的。情况有所好转,但由于某种原因,它仍然处于中断状态。有没有一种方法可以使文本像之前的列一样自动换行?

我将代码在这里。我删除了网站的大部分内容,因为它们并不重要,但保留了整个CSS代码

这是它的外观图像

Text cutting off at 768px

这是codepen https://codepen.io/hailtothev612/pen/JjXVjMP

HTML

    <!DOCTYPE html>
<html lang="en">
  <head>
    <Meta charset="utf-8">
    <Meta http-equiv="X-UA-Compatible" content="IE=edge">
    <Meta name="viewport" content="width=device-width,initial-scale=1">

    <title>Stages of Change Counseling</title>

    <!--Bootstrap-->
    <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css" integrity="sha384-JcKb8q3iqJ61gNV9KGb8thSsNjpSL0n8PARn9HuZonixN0hoP+VmmDGMN5t9UJ0Z" crossorigin="anonymous">
    <link rel="stylesheet" href="css/styles.css">
    <link rel="stylesheet" href="css/normalize.css">
    <link href="https://fonts.googleapis.com/css2?family=Cormorant+Garamond:wght@400;500;700&display=swap" rel="stylesheet">
    <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
    <!--[if lt IE 9]>
      <script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
      <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
    <![endif]-->
    </head>

    <body data-spy="scroll" data-target="#navbar">
        <nav id="navbar" class="navbar navbar-expand-lg navbar-dark sticky-top">
          <a href="index.html" id="navbarBrand" class="navbar-brand">Stages of Change Counseling</a>
          <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
            <span class="navbar-toggler-icon"></span>
          </button>

          <div id="navbarNav" class="collapse navbar-collapse">
            <ul class="navbar-nav ml-auto">
              <li class="nav-item">
                <a href="#home" class="nav-link">Home <span class="sr-only">(current)</span></a>
              </li>
              <li class="nav-item">
                <a href="#about" class="nav-link">About</a>
              </li>
              <li class="nav-item">
                <a href="#services" class="nav-link">Services</a>
              </li>
              <li class="nav-item">
                <a href="#approach" class="nav-link">Approach</a>
              </li>
              <li class="nav-item">
                <a href="#commitment" class="nav-link">Commitment</a>
              </li>
              <li class="nav-item">
                <a href="#contact" class="nav-link">Contact</a>
              </li>
            </ul>
          </div><!--navbarNav-->
        </nav>

        <main>

          <section id="contact">
            <div class="container-fluid">
              <div class="row">
                <div class="col-12">
                  <h1 class="header">Contact</h1>
                </div><!--col-->
                <div class="col-md-3 mx-auto contact-items"><h5>Phone</h5><span class="contact-text"><a href="tel:2033123812" id="phone">203.312.3812</a></span></div>
                <div class="col-md-3 mx-auto contact-items"><h5>Address</h5><span class="contact-text">495 Orange St,3rd floor,New Haven,CT 06511</span></div>
                <div class="col-md-3 mx-auto contact-items"><h5>Email</h5><span class="contact-text"><a href="mailto:stagesofchangecounseling@gmail.com" id="mailto">stagesofchangecounseling@gmail.com</a></span></div>
              </div><!--row-->
            </div><!--container-->
          </section>

        </main>


        <!--jQuery-->
        <script src="https://code.jquery.com/jquery-3.5.1.min.js" integrity="sha256-9/aliU8dGd2tb6OSsuzixeV4y/faTqgFtohetphbbj0=" crossorigin="anonymous"></script>
        <script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.1/dist/umd/popper.min.js" integrity="sha384-9/reFTGAW83EW2RDu2S0VKaIzap3H66lZH81PoYlFhbGU+6BZp6G7niu735Sk7lN" crossorigin="anonymous"></script>
        <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js" integrity="sha384-B4gt1jrGC7Jh4AgTPSdUtOBvfO8shuf57BaghqFfPlYxofvL8/KUEfYiJOMMV+rV" crossorigin="anonymous"></script>
        <script type="text/javascript" src="js/script.js"></script>
    </body>
</html>

CSS

*{
   margin: 0;
   padding: 0;
   Box-sizing: border-Box;
   font-family: 'Cormorant Garamond',serif;
   color: #B19BD9; 
   overflow-x: hidden;
}

#navbar {
    background: #B19BD9;
    text-transform: uppercase;
}

.navbar-dark .navbar-nav .nav-link {
    color: rgba(255,255,1);
    padding-right: 15px;
}

.navbar-dark .navbar-toggler {
    color: rgba(255,1);
    border: solid 2px rgba(255,.5);
}

section {
    padding-bottom: 80px;
}

#cta {
    font-weight: 700;
    font-size: 1.5rem;
    text-align: center;
    padding-top: 50px;
}

.main-text {
    font-size: 1.2rem;
    text-align: center;
    padding-top: 40px;
}

.header{
    font-weight: 700;
    text-align: center;
    text-transform: uppercase;
    padding: 30px 0 20px 0;
}

#services {
    background-color: rgba(177,155,217,0.1);
}

/*Bullet points*/
.s-link{
    list-style-type: none;
    font-size: 2.2rem;
}

.s-link .s-span {
    font-size: 1.2rem;
}

#services-list .s-link:before{
    content: "\2022";
    vertical-align: middle;
    padding-right: 10px;
}

#contact{
    background-color: rgba(177,0.1);
}

.contact-items {
    text-align: center;
    text-transform: uppercase;
}

h5{
    font-weight: 700;
}

.contact-text{
    font-weight: 400;
    font-size: 1.2rem;
    text-transform: none;
}


#phone,#mailto{
    text-decoration: none;
    color: #B19BD9;
}

#phone:hover,#mailto:hover {
    color: rgba(177,0.6);
}

footer{
    background-color: #B19BD9;
    padding: 10px;
}

p#footerText{
    padding-top: 12px;
    color: white;
}

span#heart {
    color: pink;
}

a#website {
    text-decoration: none;
    color: white;
}

a#website:hover {
    color: rgba(255,0.8)
}

@media only screen and (max-width: 1200px) {
    #dogs {
        padding-top: 40px;
    }

    section {
        padding-bottom: 30px;
    }

    .main-text {
        padding-top: 25px;
    }

    .contact-items {
        padding-bottom: 20px;
    }
}

解决方法

overflow-wrap: break-word;添加到您的a标签

#mailto {
    text-decoration: none;
    color: #B19BD9;
    overflow-wrap: break-word;
}

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。