如何使用引导程序3.3.7在悬停时放大/弹出引导程序卡

时间:2018-07-09 02:38:08

标签: html css twitter-bootstrap

在这里我要显示的是3张引导卡,在这里我要实现的是将鼠标悬停在卡上,该卡必须使用j查询/ java脚本进行缩放或弹出。 Like the image below i am trying to achieve通过使用CSS可以实现,但是如何在Bootstrap中实现

下面是我使用CSS的mycard代码

<div>
                <article class="plan">
                    <h1>FREE</h1>
                    <h2>$0/month</h2>
                    <h3>For hobby projects or small teams.</h3>
                    <ul class="plan__features">
                        <li>1 Workspace</li>
                        <li>Unlimited Traffic</li>
                        <li>10GB Storage</li>
                        <li>Basic Support</li>
                    </ul>
                    <div>
                        <button>CHOOSE PLAN</button>
                    </div>
                </article>
                <article class="plan plan--highlighted">
                    <h1 class="plan__annotation">RECOMMENDED</h1>
                    <h1>PLUS</h1>
                    <h2>$29/month</h2>
                    <h3>For ambitious projects.</h3>
                    <ul class="plan__features">
                        <li>5 Workspaces</li>
                        <li>Unlimited Traffic</li>
                        <li>100GB Storage</li>
                        <li>Plus Support</li>
                    </ul>
                    <div>
                        <button>CHOOSE PLAN</button>
                    </div>
                </article>
                <article class="plan">
                    <h1>PREMIUM</h1>
                    <h2>$99/month</h2>
                    <h3>Your enterprise solution.</h3>
                    <ul class="plan__features">
                        <li>10 Workspaces</li>
                        <li>Unlimited Traffic</li>
                        <li>Unlimited Storage</li>
                        <li>Priority Support</li>
                    </ul>
                    <div>
                        <button>CHOOSE PLAN</button>
                    </div>
                </article>
            </div>

3 个答案:

答案 0 :(得分:1)

您可以作为参考:)

.plan{
background-color:#c9f78c;
padding-top:10px;
padding-bottom:10px;
}
.plan__features{
list-style-type:none;
}
.plan:hover{
background-color:green;
}
<!DOCTYPE html>
<html lang="en">
<head>
  <title>Bootstrap Card</title>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
  <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
</head>
<body>

<div class="container">
<div class="row">
  <div class="col-md-4 text-center">
    <article class="plan">
        <h1>FREE</h1>
        <h2>$0/month</h2>
        <h3>For hobby projects or small teams.</h3>
        <ul class="plan__features">
            <li>1 Workspace</li>
            <li>Unlimited Traffic</li>
            <li>10GB Storage</li>
            <li>Basic Support</li>
        </ul>
        <div>
            <button>CHOOSE PLAN</button>
        </div>
    </article>
  </div>
  <div class="col-md-4 text-center">
  <article class="plan plan--highlighted">
        <h1 class="plan__annotation">RECOMMENDED</h1>
        <h1>PLUS</h1>
        <h2>$29/month</h2>
        <h3>For ambitious projects.</h3>
        <ul class="plan__features">
            <li>5 Workspaces</li>
            <li>Unlimited Traffic</li>
            <li>100GB Storage</li>
            <li>Plus Support</li>
        </ul>
        <div>
            <button>CHOOSE PLAN</button>
        </div>
    </article>
  </div>
  <div class="col-md-4 text-center">
  <article class="plan">
        <h1>PREMIUM</h1>
        <h2>$99/month</h2>
        <h3>Your enterprise solution.</h3>
        <ul class="plan__features">
            <li>10 Workspaces</li>
            <li>Unlimited Traffic</li>
            <li>Unlimited Storage</li>
            <li>Priority Support</li>
        </ul>
        <div>
            <button>CHOOSE PLAN</button>
        </div>
    </article>
  </div>

</div>

</div>
 

</body>
</html>

答案 1 :(得分:1)

您在寻找这种解决方案吗?

h1 { font-size: 170% !important; }
h2 { font-size: 150% !important; }
h3 { font-size: 130% !important; }
h4 { font-size: 110% !important; }

article.plan { 
 margin: 20px; 
 border: #ddd solid 1px; 
 background: #f4f4f4; 
 font-size: 14px;
 padding: 10px;
    transition: all 0.5s;
    -webkit-transition: all 0.5s; /* Safari 3.1 to 6.0 */
}

article.plan:hover { 
 margin: 12px; 
 font-size: 15px;
 
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.1/js/bootstrap.min.js"></script>
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css" rel="stylesheet"/>
<div class="row">
  <div class="col-4">
    <article class="plan">
      <h1>FREE</h1>
      <h2>$0/month</h2>
      <h3>For hobby projects or small teams.</h3>
      <ul class="plan__features">
        <li>1 Workspace</li>
        <li>Unlimited Traffic</li>
        <li>10GB Storage</li>
        <li>Basic Support</li>
      </ul>
      <div>
        <button>CHOOSE PLAN</button>
      </div>
    </article>
  </div>
  <div class="col-4">
    <article class="plan plan--highlighted">
      <h1 class="plan__annotation">RECOMMENDED</h1>
      <h1>PLUS</h1>
      <h2>$29/month</h2>
      <h3>For ambitious projects.</h3>
      <ul class="plan__features">
        <li>5 Workspaces</li>
        <li>Unlimited Traffic</li>
        <li>100GB Storage</li>
        <li>Plus Support</li>
      </ul>
      <div>
        <button>CHOOSE PLAN</button>
      </div>
    </article>
  </div>
  <div class="col-4">
    <article class="plan">
      <h1>PREMIUM</h1>
      <h2>$99/month</h2>
      <h3>Your enterprise solution.</h3>
      <ul class="plan__features">
        <li>10 Workspaces</li>
        <li>Unlimited Traffic</li>
        <li>Unlimited Storage</li>
        <li>Priority Support</li>
      </ul>
      <div>
        <button>CHOOSE PLAN</button>
      </div>
    </article>
  </div>
</div>

答案 2 :(得分:1)

您最好,最简单的方法是将其添加到您的CSS代码中。

.plan:hover{transform:scale(1.1); background:green; color:#fff;} or .plan:hover h1,h2,h2{color:#fff;}

或者您可以根据需要使用scale属性,甚至还可以向.plan类添加过渡持续时间。