html - How to center multiple images -
how center multiple images in div element?
basically, need center 4 images. else seems fine. looked through similar questions , tried out nothing seemed work - 1 of them, however, centered images. problem images spread out across of page, when need there couple pixels of space between images.
html:
<!doctype html> <html> <head> <title>assignment5.html</title> <link rel="stylesheet" type="text/css" href="css.css"> </head> <body> <h1>visit these famous places</h1> <div> <img src="images/beijing-china.jpg" alt="beijing" title="beijing, china"> <img src="images/grand-canyon.jpg" alt="grand canyon" title="grand canyon, pheonix, usa"> <img src="images/sydney-opera-house.jpg" alt="sydney opera hourse" title="sydney opera house, sydney, australia"> <img src="images/statue-of-liberty.jpg" alt="statue of liberty" title="statue of liberty, new york, usa"> </div> </body> </html>
css:
h1 { text-align: center; text-shadow: grey 2px 2px 10px; } div { align-items: center; display: flex; flex-direction: row; justify-content: space-between; } img { height: 100px; width: 150px; border: 3px solid black; border-radius: 20px; margin: 0px auto; display: block; }
you should put
div{ ... text-align: center; ... }
Comments
Post a Comment