Web programming: the “auto” setting

The tutor talks a bit about “auto”: is it the default setting for layout?

I’ve read that “auto” is default: unless you set the property to something else in particular, the element will be rendered as though that property was “auto”. Not always, in my experience; I’ll show you now:

Here’s an image without the “margin:auto” setting:

<img src=”source0.abc” style=”display:block” />

Here’s the same image with “margin:auto” included:

<img src=”source0.abc” style=”display:block;margin:auto” />

I’ve viewed this post in Chrome, ie11, and Firefox. In each case, the top image is left-aligned, while the bottom one is centered.

So many times I’ve keyed “margin:auto” wondering “Is this redundant?” Certainly not always:)

Source:

w3schools.com

Jack of Oracle Tutoring by Jack and Diane, Campbell River, BC.

Leave a Reply