0

I have an example here of a problem

http://patrickmchugh.com/template-image-nav-bootstrap.html I am trying to have the navigation arrows on either side of the image sit half way down the window.

I have tried tables, padding, margins but have not been successful. Any suggestions

    <div class="container-fluid">
        <div class="row-fluid">
                <div class="span1">
                    <img src="images/leftArrow.png" alt="back one image"></div>
        <div class="span10 pagination-centered">
                    <img src="images/fashion-1.jpg" alt="fashion-photo"></div>
        <div class="span1">
                    <img src="images/rightArrow.png" alt="next"></div>
        </div>
    </div>
madth3
  • 7,275
  • 12
  • 50
  • 74
paddym
  • 29
  • 1
  • 7

1 Answers1

1

I'd use position: absolute with top: 50%. A negative margin-top of have the arrow image height makes the vertically centered.

Make the <div> surrounding the image display: inline-block to make it as large as wide as the image instead of the full screen. A padding makes the arrows fall beside the image instead of over them. Add a container to center it all.

<div class="mycontainer">
    <div class="mycarousel">
        <img class="arrow-prev" src="http://patrickmchugh.com/images/leftArrow.png" alt="previous" />
        <img class="arrow-next" src="http://patrickmchugh.com/images/rightArrow.png" alt="next" />
        <img src="http://patrickmchugh.com/images/fashion-1.jpg" alt="fashion-photo" />
    </div>
</div>

The CSS

.mycontainer {
    text-align: center;
}

.mycarousel {
    position: relative;
    padding: 0 25px;
    display: inline-block;
    max-width: 100%;
}

.mycarousel img {
   max-width: 100%;    
}
.arrow-prev {
    position: absolute;
    left: 0;
    top: 50%;
    margin-top: -7px;
}

.arrow-next {
    position: absolute;
    right: 0;
    top: 50%;
    margin-top: -7px;
}

See the jsFiddle

Arnold Daniels
  • 16,516
  • 4
  • 53
  • 82