Why is my div element not centering?
You’re using mark-up to represent visual effect, this is what CSS is for. To a blind user, using a screen reader, a | when reading out the navigation will mean nothing.
Does it make me a jerk to not consider my screen-reading brethren? Lol. Didn’t even cross my mind. Thanks for the tip. 🙂
3 Answers 3
To center the footer contents horizontally, just add the following CSS:
If you’re looking to center the entire element, just give it a width and then use margin: 0 auto :
The width of ul#footer is undefined, so it uses the default width of «100%». I tried using width:261px, and then it does center.
Right you are. In order to use margin: auto; as a method of centering a block-level element you’d need to specify a width, otherwise it would take up 100% of the width anyway
@Tyler: I think you’re confusing the CSS text-align property with the deprecated align attribute in HTML. There’s nothing wrong with text-align , no matter how you use it.
Accidentally deleted the comment trying to edit it. Yes, that’s what I thinking about. Little did I know it, though. Lol. Thanks. 🙂
Related
Hot Network Questions
Subscribe to RSS
To subscribe to this RSS feed, copy and paste this URL into your RSS reader.
Site design / logo © 2023 Stack Exchange Inc; user contributions licensed under CC BY-SA . rev 2023.7.25.43544
By clicking “Accept all cookies”, you agree Stack Exchange can store cookies on your device and disclose information in accordance with our Cookie Policy.
Cannot get CSS Elements centered
I cannot get my site to be centered for the life of me with CSS. I have tried all the usual methods suggested around the web including:
csselement
)" data-controller="se-share-sheet" data-se-share-sheet-title="Share a link to this question" data-se-share-sheet-subtitle="" data-se-share-sheet-post-type="question" data-se-share-sheet-social="facebook twitter devto" data-se-share-sheet-location="1" data-se-share-sheet-license-url="https%3a%2f%2fcreativecommons.org%2flicenses%2fby-sa%2f2.5%2f" data-se-share-sheet-license-name="CC BY-SA 2.5" data-s-popover-placement="bottom-start">Share)" title="">Improve this questionasked Aug 28, 2009 at 14:42 EricEric3383 gold badges9 silver badges16 bronze badgesAdd a comment|