C
C
codenaki2017-12-20 11:19:53
HTML
codenaki, 2017-12-20 11:19:53

How to set the size correctly?

<div class="container">
    <div class="row">
        <div class="carousel slide " data-ride="carousel" id="myCarousel">
            <!--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>
                <li data-target="#myCarousel" data-slide-to="3"></li>
            </ol>
            <!--Wrapper for sliders!-->
            <div class="carousel-inner" role="listbox">

                <div class="item active">
                    <img src="{{asset('images/main-page-slider/zoo.jpg')}}" alt="air-balloon" class="img-responsive">
                    <div class="carousel-caption">
                        <h4>Israel Zoos!</h4>
                        <p>Check the information here <a href="http://www.utopiapark.co.il/"> click .. </a></p>
                    </div>
                </div>

                <div class="item">
                    <img src="{{asset('images/main-page-slider/pexels-photo-131213.jpeg')}}" alt="food" class="img-responsive">
                    <div class="carousel-caption">
                        <h4>Rivers Of Israel!</h4>
                        <p>Check the information here <a href="http://lib.cet.ac.il/pages/item.asp?item=9612"> click
                                .. </a></p>
                    </div>
                </div>

                <div class="item">
                    <img src="{{asset('images/main-page-slider/forest.jpg')}}" alt="camping-nature" class="img-responsive">
                    <div class="carousel-caption">
                        <h4>Israel Forests!</h4>
                        <p>Check the information here <a href="http://www.kkl.org.il/forestsearch/"> click .. </a></p>
                    </div>
                </div>

                <div class="item">
                    <img src="{{asset('images/main-page-slider/pexels-photo.jpg')}}" alt="beach" class="img-responsive">
                    <div class="carousel-caption">
                        <h4>The Shores Of Tel Aviv!</h4>
                        <p>Check the information here <a href="http://www.mouse.co.il/kids/articles/1.3154390"> click
                                .. </a></p>
                    </div>
                </div>

            </div>

            <!--Left and right controls!-->
            <a class="left carousel-control" href="#myCarousel" role="button" data-slide="prev">
                <span class="glyphicon glyphicon-chevron-left" aria-hidden="true" id="prev"></span>
                <span class="sr-only ">Previous</span> <!--For screen readers only! -->
            </a>
            <a class="right carousel-control" href="#myCarousel" role="button" data-slide="next">
                <span class="glyphicon glyphicon-chevron-right" aria-hidden="true" id="next"></span>
                <span class="sr-only ">Next</span> <!--For screen readers only! -->
            </a>
        </div>
    </div>
</div>

#myCarousel {
     height: 500px;
    width: 100%;
    & .carousel-inner {
      height: 100%;
      width: 100%;
      & .item {
        height: 100%;
        width: 100%;
      }
    }
  }

I can’t set the size for #myCarouselwhen the slides change the height, what is missing in the code so that the height is kept constant at 500 pixels when slides?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Anton Shamanov, 2017-12-20
@SilenceOfWinter

it is necessary to limit the height of the image or partially hide it (overflow)

S
Stalker_RED, 2017-12-20
@Stalker_RED

height: 100%;
width: auto; /* это свойство можно вообще не писать */

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question