Hi all,
I need help with the picture and text below. It doesn’t seem to want to centre?
Please find my Code pen below. Thanks
https://codepen.io/lydiaspence/pen/RwbRdOj
Hi all,
I need help with the picture and text below. It doesn’t seem to want to centre?
Please find my Code pen below. Thanks
https://codepen.io/lydiaspence/pen/RwbRdOj
Use the auto
value for the left and right margins of the block in question (in this case the .div-information
one). There’s no align
property in CSS.
You may also want to use max-width
instead of width
to make it more responsive. It will cause the block to shrink when the viewport is not wide enough, but max out to 900px. Adding the auto margins to its sides will center it as well.
For the image, you may also want to use margin: auto
to center it. However images are inline elements by default (they sort of behave like text), so margins don’t apply. Changing it to display: block
allows for setting margins. You might also want to change its width
to max-width
so it only grows as much as its intrinsic width, not the width of the page.
Also some heads-up. You’re missing a =
for img-div
in the HTML.
thanks Kevcomedia, will try that