Jump to content
Sign in to follow this  
Terrorer

Margin with Tables-Need help

Recommended Posts

I am new to CSS and HTML really and I have been reading the tutorials for a week now. So I am making this website, just on my G drive though, as I am not paying for a server. It's really just a table right now, with a title picture and some links to the other pages, an Iframe for my little slideshow and some color here and there. I have a style sheet, and I sort of get it really, but most things that happened on it were trial and error stuff (the ordering on that thing confuses me so much). My problem though, is that i want my table, of my website, to have a margin, so it's in the middle. How do I give it one? I've been trying for a bit now but nothing really works. I really just don't know where to put it. I can put the margin as a class or id, but I have no clue where to put it on my style sheet or the web pages.

Edited by Terrorer

Share this post


Link to post
Share on other sites

Lets do something just a little different to help you understand what's going on. I'm going to use a <div>, you can change it to a proper <table> if you want but I'm using <div> for simplicity's sake.

<div id="box"></div>

And you can center your <div> by using margins such as I'm doing below. I added width, height and borders so you can see the <div> as a rectangle otherwise you wouldn't be able to see it. Also if you want to be able to center an object it has to have a width smaller than whatever it's in but it does have to have a width or else you'll get crazy results.

#box {  width: 300px;  height: 200px;  border: 1px solid black;  margin: 0 auto;}

I used pixels (px) here but you can use percentages (%) so if anyone makes the window smaller, it gets smaller too.

Edited by Err

Share this post


Link to post
Share on other sites

See, I don't understand Div, not yet really, but I just forgot about my external style sheet and did it individually for each page. Worked that way, but I think it's because my style sheet is really unorganized, and I have no clue where to put things. Thanks though. :3

Edited by Terrorer

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...