css - How do i make all my content centered in html -
i started making page web design class , ran problem. page has navigation bar , picture far. wanted center them both using css.
display: block; margin-left: auto; margin-right: auto
i used both nav bar , img. want nav bar above image if page gets resized. there anyway in css?
margins center if element has width. css might like:
img{ width:300px; margin: 0 auto; } nav{ width:600px; margin: 0 auto; }
basic html:
<nav> <ul> <li>something</li> <li>something else</li> </ul> </nav> <img src="../path-to-file.jpg" alt="image">
that center both elements.
as making nav above image... mean overlapping it? or "above" way question above answer?
i can update post if make clear.
Comments
Post a Comment