I’m using a simple conditional to show sidebar only if the URL contains certain word. However, when the sidebar is gone, I want the content to be placed in the center. I’m using the following in my PHP. I originally thought margin: X auto; should do the trick, but it didn’t. I also tried to remove ‘float:left;’, but the content is still coming from the left side.
Wouldn’t it be easier to use the same conditional statement being used to add the sidebar to add a class to the content div you’re trying to center? That way you can just control the styles via stylesheet and you don’t have to echo echo out a style tag on the page.
hi timmey, I know I’m asking to centering stuff, but I’m looking to center the “content” box, not the text in there. And for noahgelman, it would be a great habit to form (which is not something I have a lot), but that doesn’t really solve the issue I have right now.
oh, sorry I missed that. Guess small windows are bad things, sometimes. Thanks a lot.
Edit: Just tried to use ‘position: relative;’ instead of ‘float: left;’, didn’t work. Removing ‘float: left;’ didn’t work either. Bummer. But it wasn’t too much of a big deal. Guess I will just let it go.