There is a gray area on the right side of the image (shown below in the image). If I focus the image inside the carousel, the gray area is evenly divided to the left and right of the image. Is there a way to remove this and make the carousel the same size as the images.
<!DOCTYPE html> <html> <head> <title>Test</title> <!-- Latest compiled and minified CSS --> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"> <!-- jQuery library --> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script> <!-- Latest compiled JavaScript --> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script> <style> .item { max-height: 400px; } </style> </head> <body> <!------------nav bar ----------------------> <nav class="navbar navbar-default"> <div class="container-fluid"> <div class="navbar-header"> <a class="navbar-brand" href="#">HOME</a> </div> <ul class="nav navbar-nav"> <li><a href="#">GALLERY</a></li> <li><a href="#">REFERENCES</a></li> </ul> </div> </nav> <!--------------Centering div ---------------> <div class="container-fluid"> <div class="row"> <div class="col-md-offset-1 col-md-10"> <div id="myCarousel" class="carousel slide" data-ride="carousel"> <!-- Indicators --> <ol class="carousel-indicators"> <li data-target="#myCarousel" data-slide-to="0" class="active"></li> <li data-target="#myCarousel" data-slide-to="1"></li> <li data-target="#myCarousel" data-slide-to="2"></li> </ol> <!-- Wrapper for slides --> <div class="carousel-inner"> <div class="item active"> <img src="http://res.cloudinary.com/dstd7egax/image/upload/v1497784186/davinciSelf_lma2vh.jpg"> </div> <div class="item"> <img class src="http://res.cloudinary.com/dstd7egax/image/upload/v1497784193/Madonna_i9fj4t.png" alt="Chicago"> </div> <div class="item"> <img src="http://res.cloudinary.com/dstd7egax/image/upload/v1497784183/davinciSketch_zs4fv5.jpg" alt="New York"> </div> </div> <!-- Left and right controls --> <a class="left carousel-control" href="#myCarousel" data-slide="prev"> <span class="glyphicon glyphicon-chevron-left"></span> <span class="sr-only">Previous</span> </a> <a class="right carousel-control" href="#myCarousel" data-slide="next"> <span class="glyphicon glyphicon-chevron-right"></span> <span class="sr-only">Next</span> </a> </div> </div> </div> </div> </body> </html>
Extra space
Based on your 800 pixel wide images, this rule captures that
#myCarousel { margin: 0 auto; max-width: 800px; }
Fragment of a stack
<!DOCTYPE html> <html> <head> <title>Test</title> <!-- Latest compiled and minified CSS --> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"> <!-- jQuery library --> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script> <!-- Latest compiled JavaScript --> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script> <style> .item { max-height: 400px; } #myCarousel { margin: 0 auto; max-width: 800px; } </style> </head> <body> <!------------nav bar ----------------------> <nav class="navbar navbar-default"> <div class="container-fluid"> <div class="navbar-header"> <a class="navbar-brand" href="#">HOME</a> </div> <ul class="nav navbar-nav"> <li><a href="#">GALLERY</a></li> <li><a href="#">REFERENCES</a></li> </ul> </div> </nav> <!--------------Centering div ---------------> <div class="container-fluid"> <div class="row"> <div class="col-md-offset-1 col-md-10"> <div id="myCarousel" class="carousel slide" data-ride="carousel"> <!-- Indicators --> <ol class="carousel-indicators"> <li data-target="#myCarousel" data-slide-to="0" class="active"></li> <li data-target="#myCarousel" data-slide-to="1"></li> <li data-target="#myCarousel" data-slide-to="2"></li> </ol> <!-- Wrapper for slides --> <div class="carousel-inner"> <div class="item active"> <img src="http://res.cloudinary.com/dstd7egax/image/upload/v1497784186/davinciSelf_lma2vh.jpg"> </div> <div class="item"> <img class src="http://res.cloudinary.com/dstd7egax/image/upload/v1497784193/Madonna_i9fj4t.png" alt="Chicago"> </div> <div class="item"> <img src="http://res.cloudinary.com/dstd7egax/image/upload/v1497784183/davinciSketch_zs4fv5.jpg" alt="New York"> </div> </div> <!-- Left and right controls --> <a class="left carousel-control" href="#myCarousel" data-slide="prev"> <span class="glyphicon glyphicon-chevron-left"></span> <span class="sr-only">Previous</span> </a> <a class="right carousel-control" href="#myCarousel" data-slide="next"> <span class="glyphicon glyphicon-chevron-right"></span> <span class="sr-only">Next</span> </a> </div> </div> </div> </div> </body> </html>
One quick fix, add this css:
.carousel-control.right, .carousel-control.left { background: transparent!important; }
- . , , .
Source: https://habr.com/ru/post/1679556/More articles:Where are the "elements" stored in the generator? - pythonTo get rid of #! in angularjs ngRoute - javascriptIs port 3306 not listening? Unable to connect to MySQL remotely - mysqlJava speeds up reference to 'this' - javaHow are ternary expressions evaluated in Java? - javaРекомендуется ли вызывать Disposable.dispose(), как только подписка завершает работу? - androidDjango constant - conservation method - djangoHow to use plugins like vue-resource when using Vue.js with Typescript? - javascriptSearch for Haskell Parallel Search with Early Interruption - parallel-processingIn the list component, how to implement the component to change the number of displayed results - admin-on-restAll Articles