移动img位置

时间:2018-03-19 04:43:33

标签: html css

所以这是我的img

当前位置

enter image description here

我想知道我是否可以移动图像位置

到这个

enter image description here

我尝试使用position:absolute with,top bottom right left left adjust,但仍无效。

<div id="myCarousel" class="carousel slide" data-ride="carousel">
            <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="1"></li>
            </ol>

            <div class="carousel-inner">
                <div class="item active" style="height: 320px;"> 
                    <img src="./img/flat1.jpg" alt="flat1" style="width: 100%;">
                        <div class="carousel-caption">
                            <h3>This is flat</h3>
                            <p>flat wallpaper</p>
                        </div>
                </div>
                <div class="item" style="height: 320px;">
                    <img src="./img/flat2.jpg" alt="flat2" style="width: 100%;">
                        <div class="carousel-caption">
                            <h3>This is flat wallpaper</h3>
                                <p>This is During summer</p>
                        </div>
                </div>
                <div class="item" style="height: 320px;">
                    <img src="./img/flat3.jpg" alt="flat3" style="width: 100%;">
                        <div class="carousel-caption">
                            <h3>Bora</h3>
                                <p>During Day time</p>
                        </div>
                </div>
            </div>

            <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>

1 个答案:

答案 0 :(得分:1)

您可以使用.main的值为position:relative,以获得您要查找的结果。

&#13;
&#13;
top
&#13;
.item img {
  position: relative;
  top: -120px;
}
&#13;
&#13;
&#13;