Bootstrap 3到Bootstrap 4隐藏元素

时间:2018-04-25 07:43:02

标签: twitter-bootstrap bootstrap-4

我尝试从bootstrap3迁移到bootstrap4。这是非常痛苦的,在线转换器根本不起作用。

E.g。我甚至无法将以下bootstrap 3块转换为bootstrap 4

body {
  min-height: 1200px;
  padding-top: 140px;
}

.header {
/*    border-bottom: 1px solid #D8D8D8;*/
    font-family: arial;
    padding-top: 20px;
    padding-bottom: 20px;
    z-index: 100;
    background: white;
    
    position: fixed;
    top: 0;
    right: 0;
    left: 0;
}

.one-edge-shadow {
	-webkit-box-shadow: 0 8px 6px -6px black;
	   -moz-box-shadow: 0 8px 6px -6px black;
	        box-shadow: 0 8px 6px -6px black;
}

.centerText {
    text-align: center;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.0.0/css/bootstrap.min.css">

<!-- Optional theme -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap-theme.min.css">

<!-- Latest compiled and minified JavaScript -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.0.0/js/bootstrap.min.js"></script>

<div class="container-fluid header one-edge-shadow">
    <div class="row" style="position: relative;">
        <div class="col-lg-12 hidden-md hidden-sm hidden-xs" style="position: absolute;">
            <h3 class="centerText">Dashboard</h3>
        </div>

        <!-- Logo -->
        <div class="col-lg-11 col-lg-offset-1 hidden-sm hidden-xs">
            <img src="http://via.placeholder.com/200x100">
        </div>
        <div class="col-xs-12 hidden-lg hidden-md">
            <center><img src="http://via.placeholder.com/150x80"></center>
        </div>
    </div>
</div>

尝试:

body {
  min-height: 1200px;
  padding-top: 140px;
}

.header {
/*    border-bottom: 1px solid #D8D8D8;*/
    font-family: arial;
    padding-top: 20px;
    padding-bottom: 20px;
    z-index: 100;
    background: white;
    
    position: fixed;
    top: 0;
    right: 0;
    left: 0;
}

.one-edge-shadow {
	-webkit-box-shadow: 0 8px 6px -6px black;
	   -moz-box-shadow: 0 8px 6px -6px black;
	        box-shadow: 0 8px 6px -6px black;
}

.centerText {
    text-align: center;
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" rel="stylesheet"/>

<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>

<div class="container-fluid header one-edge-shadow">
    <div class="row" style="position: relative;">
        <div class="col-lg-12 d-md-none d-sm-none d-xs-none" style="position: absolute;">
            <h3 class="centerText">Dashboard</h3>
        </div>

        <!-- Logo -->
        <div class="col-lg-11 col-lg-offset-1 d-sm-none d-xs-none">
            <img src="http://via.placeholder.com/200x100">
        </div>
        <div class="col-xs-12 d-lg-none d-md-none">
            <center><img src="http://via.placeholder.com/150x80"></center>
        </div>
    </div>
</div>

Documentation

请执行示例并按“完整页面”。

0 个答案:

没有答案