html - centering images within a sidebar -
trying best practices here , i'm new coding. have 2 images in right sidebar. sidebar looks (colored red see what's up) can't 2 images centered in column. what's wrong css?
html:
<div class="right_bar"> <div class="sponsor_button"><img src="images/nav_images/uconn-grant-logo.png" alt="sponsored in part university of connecticut's research grant";></div class="sponsor_button"> <div><img src="images/nav_images/usitt.png" alt="sponsored in part usitt";> </div> </div>
css:
.right_bar { position:absolute; right:0; width: 20%; background-color: red; } .sponsor_button img { margin-left:auto; margin-right:auto; }
you need display: block
on images margin: 0 auto
work:
.sponsor_button img { display: block; margin-left: auto; margin-right: auto; }
or try text-align: center
on container:
.right_bar { text-align: center; }
Comments
Post a Comment