I’m trying to center a div tag at the bottom of my screen in CSS. I’ve looked it up online and it seems simple to do but I just can’t figure it out and/or understand what I’m doing with it. Do you think someone could explain it a little to me? Or point me to a reference that does a good job at it?
cool, thanks.
Hey, while I’m at it, does anyone know if you can pass literal values from a CSS? I haven’t looked much into it but I was just curious if I could have a word or phrase appear at the bottom of every page utilizing a CSS.
That’s not really what CSS is for. The purpose of CSS is to separate design from content. If you want a common footer on every page, look into something like server-side includes.
You would make the right and left margins “auto” like this:
#bottomdiv {
margin: 0 auto;
}
Where the 0 is the margin for the top and bottom, and you can change that if you need to. Auto is for the right and left margins and that centers it. If you wanted different top and bottom margins it could look like this:
well, I’m trying what you guys are suggesting, and its working to some degree. The DIV is centering around the text so that when I apply a border, it is against the text that is on the page. However, I’m still having problems.
I can’t get the actual DIV to center in the page. It is still appearing in the lower left hand corner. Here is my DIV, maybe I’m just doing something wrong? I keep trying to add code to align it in the div tag (IE align:“center” or align: “center”) but nothing seems to be working.
Actually, upon trying this again, it seems to be working. I just have to get that footercontainer to now go to the bottom. Shouldn’t be too much of a trouble. Thanks!