• Bootstrap轮播/传送带/carousel图片居中的处理方法


    <!DOCTYPE html>
    <html>
    
    	<head>
    		<meta charset="utf-8">
    		<meta http-equiv="X-UA-Compatible" content="IE=edge">
    		<meta name="viewport" content="width=device-width, initial-scale=1">
    		<!-- 上述3个meta标签*必须*放在最前面,任何其他内容都*必须*跟随其后! -->
    		<title>Bootstrap 101 Template</title>
    
    		<!-- Bootstrap -->
    		<link href="css/bootstrap.min.css" rel="stylesheet">
    		<link rel="stylesheet" href="css/sliderStyle.css" />
    		<!-- 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://cdn.bootcss.com/html5shiv/3.7.3/html5shiv.min.js"></script>
          <script src="https://cdn.bootcss.com/respond.js/1.4.2/respond.min.js"></script>
        <![endif]-->
    	</head>
    
    	<body>
    
    		<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
    		<script src="https://cdn.bootcss.com/jquery/1.12.4/jquery.min.js"></script>
    		<!-- Include all compiled plugins (below), or include individual files as needed -->
    		<script src="js/bootstrap.min.js"></script>
    
    		<div class="container">
    			<div id="slider_wrap">
    				<div id="carousel-example-generic" class="carousel slide" data-ride="carousel">
    					<!-- Indicators -->
    					<ol class="carousel-indicators">
    						<li data-target="#carousel-example-generic" data-slide-to="0" class="active"></li>
    						<li data-target="#carousel-example-generic" data-slide-to="1"></li>
    						<li data-target="#carousel-example-generic" data-slide-to="2"></li>
    					</ol>
    
    					<!-- Wrapper for slides -->
    					<div class="carousel-inner" role="listbox">
    						<div class="item active">
    							<img src="img/1.jpg" alt="target">
    							<div class="carousel-caption">
    
    							</div>
    						</div>
    						<div class="item">
    							<img src="img/2.jpg" alt="bussiness">
    							<div class="carousel-caption">
    
    							</div>
    						</div>
    						<div class="item">
    							<img src="img/3.jpg" alt="global">
    							<div class="carousel-caption">
    								<h3>global marcket</h3>
    								<p>blablabla</p>
    							</div>
    						</div>
    					</div>
    
    					<!-- Controls -->
    					<a class="left carousel-control" href="#carousel-example-generic" role="button" data-slide="prev">
    						<span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span>
    						<span class="sr-only">Previous</span>
    					</a>
    					<a class="right carousel-control" href="#carousel-example-generic" role="button" data-slide="next">
    						<span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span>
    						<span class="sr-only">Next</span>
    					</a>
    				</div>
    			</div>
    		</div>
    	</body>
    
    </html>
    

    关键是:

    .carousel-inner img {
    100%;
    }
    

     把图片的宽度设置成100%.

  • 相关阅读:
    Eureka的使用
    自定义类加载器
    继承
    Active Objects模式
    Future设计模式
    mysql备份与还原
    多生产者多消费者(第一种方式),基于synchronized,wait,notifyAll
    自己实现阻塞队列(基于数组)
    linux定时任务每隔5分钟向文本追加一行
    自己实现CountDownLatch
  • 原文地址:https://www.cnblogs.com/Montauk/p/6365838.html
Copyright © 2020-2023  润新知