Andrew Nevins
(@anevins)
WCLDN 2018 Contributor | Volunteer support
You’ll need to set a width on the #access
div – and then use the margin: 0 auto;
which centers the block element. One thing to be aware of is that if you add more menu items, you’ll need to adjust the width.
Hmmm… I was hoping that there would be a simple solution. I’m new to wordpress and css, and I really have no idea what I’m doing. I thought that it would be best to post in the wordpress forums in order to get help altering the theme. The css sites that you link to are a bit daunting.
Oh, thanks WPyogi!
I just tried setting a width and altering the margins for #access div. It doesn’t seem to have changed anything though. Any other ideas?
What you added is incorrect CSS:
#access div {
margin: 0 auto;
width: 1000;
}
That applies to any div that is inside an element with the id of access. What you need is just #access
. And width always has to have a unit of measure unless it is 0 (zero). But what you also need to do to center it is to use the minimum width of the element you are centering — say maybe 500px in this case.
You also need to remove the float by adding float: none;