Jump to content

New At This...how Do You Center Align A Table?


angelofwar83

Recommended Posts

Here so far is the beginning of what I have going on. I am trying to align my table with text inside, to the center of the page. What is the coding I need to put in to do so?<html><body bgcolor="#c0c0c0" text="red"><table border="3" bgcolor="#87ceeb"><tr><td><h1>Welcome to the Angel's 1st page!!</h1></td></table>------------------------------How do i change this so I can get the alignment for the table.? This is actually the heading for my page i am practicing creating. So would it be smarter to make it a table surrounding a head <head></head>, or is there a way to get paragraphs or sentences outlined on all 4 sides looking like it's in a table?Thank you very muchITCageRaver

Link to comment
Share on other sites

Well everyone here will tell you that you should use div's instead of tables for layout.could try something this for the header

<html><head><style type="text/css">body {color:#FF0000;background-color:#c0c0c0;}#container { width:900px; margin:0 auto; padding:0; }#header { width:900px; padding:0; text-align:center; border:3px solid #000;   background-color:87ceeb }</style></head><body><div id="container"><div id="header"><h1>Welcome to the Angel's 1st page!!</h1></div>Other Content</div></body></html>

Link to comment
Share on other sites

So would it be smarter to make it a table surrounding a head <head></head>,
<head> tags are actually NOT for content for the webpage, <head> tags are where content is that tells the browser how to act... normally for styling as I used it above and javascript and such.... also if you put <title>My Webpage</title> within the <head> tags, "My Webpage" will show at the top of the browser window when you are at your webpage.
or is there a way to get paragraphs or sentences outlined on all 4 sides looking like it's in a table?
you can create a div for those as well, using a different id or class, and style them with a CSS style like I did above for your header.to explain that a little...
body {color:#FF0000;background-color:#c0c0c0;}

these must be within <style> tags, and what it is saying is that anything within the <body> tags, the text will be FF0000 (red) and the background will be c0c0c0 (grey)

#container { width:900px; margin:0 auto; padding:0; }

this means that anything with the id="container" will have those attributes, a container div is good for keeping all the content of your page with a certain amount of pixels and centered. width:900px will contain everything within that 900 pixels, "margin:0 auto" centers it, when you have margin with two arguments, the first one is top and bottom margin, and the second is left and right, so 0 auto means that the top and bottom margins will be 0, while the left and right are automatic (which centers it)

Link to comment
Share on other sites

thx. I havent done css yet. I have just started on html through this site...so I am just practicing but I an in an IT school degree but dont my full IT classes for a few months. Just trying to get a headstart. Thx and I understood most of it. I need to go trhough css I guess too. I was just trying html. What are your thoughts on this? I mean honestly...whats the best way, through these tutorials to learn the content effectively and timely?This would be a great deal of quality advice. Thank you so much.Wes

Link to comment
Share on other sites

yea, go through the HTML and CSS tutorials... one after another to give you a general sense, then go back over things you think you need to understand better

Link to comment
Share on other sites

Instead of putting the css in a header, link it to a CSS page. That way you keep your style and your page seperate AND you can use the same styles for multiple pages. Besides, w3c wants to slowly get rid of these style tags.

Link to comment
Share on other sites

Instead of putting the css in a header, link it to a CSS page. That way you keep your style and your page seperate AND you can use the same styles for multiple pages. Besides, w3c wants to slowly get rid of these style tags.
==============================================================Would you mind showing me an example.? IM sorry to bother you guys. But a community of people helping is whats best and needed and appreciated. I know eventually I'll be on the other end as well. :) You're saying instead of having the css and putting it in per page you do...if you link it, it will only need to have ther base done once and then for all ur projects you do that go into css...you can link to your base and work from there? cutting your time of work down some. **Also, I learned how to pull links/images/pics form site ex. <a href="http://www.thispage4pics"</a>How do i get them from my computer? none of my images or pics are shown in ...it doesnt matter...how do i find out what the address(location) is for my pictures on my computer and code them in?Do they have to be pics that are online?and one last for now...I was told to use div. Can you please give me the base(s) on that and its usage. I didnt quite understand. What's it's rulebook I guess.again, i'll ask alot and thank you so much guys.
Link to comment
Share on other sites

Have an external CSS page, and then instead of putting all the styles within style tags on your page, you would just put<link rel="stylesheet" type="text/css" href="mystyle.css" />and your style sheet would look likehr {color:sienna}p {margin-left:20px}body {background-image:url("images/back40.gif")}etchttp://w3schools.com/css/default.asp

Link to comment
Share on other sites

==============================================================Would you mind showing me an example.? IM sorry to bother you guys. But a community of people helping is whats best and needed and appreciated. I know eventually I'll be on the other end as well. :) You're saying instead of having the css and putting it in per page you do...if you link it, it will only need to have ther base done once and then for all ur projects you do that go into css...you can link to your base and work from there? cutting your time of work down some. **Also, I learned how to pull links/images/pics form site ex. <a href="http://www.thispage4pics"</a>How do i get them from my computer? none of my images or pics are shown in ...it doesnt matter...how do i find out what the address(location) is for my pictures on my computer and code them in?Do they have to be pics that are online?and one last for now...I was told to use div. Can you please give me the base(s) on that and its usage. I didnt quite understand. What's it's rulebook I guess.again, i'll ask alot and thank you so much guys.
HTML CODE<!--Insert this in your <head>--><link rel="stylesheet" type="text/css" href="pageStyles.css"/>END HTML CODE

Next, create style page, using any text editor, dream weaver, etc. (###### even microsoft expression)

CSS CODE/*Insert anywhere in the CSS page*/body {color:#FF0000; background-color:#c0c0c0;}#container { width:900px; margin:0 auto; padding:0; }#header{ width:900px; padding:0; text-align:center; border:3px solid #000;  background-color:87ceeb END CSS CODE

And yes that's exactly what I'm saying. Different websites will often require different specs, but you will often on the same website you'll want the same themes on multiple pages. So for instance you might have ten pages and you'll want that table aligned center on every single one of them. Just put the link into the html, and it'll go straight to the CSS Page. As for pictures, I'm afraid, unless you have a server, you will have to put them online. In theory you could put them in a public folder and use your IP address, but it seems explaining that here won't be of much use. Photobucket has a huge amount of free server space for images. Go ahead, put them up. They even make it easy for you by supplying the code for the links, html, direct links etc. So in answer to your question, yes and no. It all depends on your level of expertise, but your computer will always have to be on if you want someone else to see them... Div tags are layers, they are the new tables. Albeit, most do not want to conform just yet. Take the big sites, ebay, amazon, gaiaonline, none of them use div tags to their full capacity, but they are a great tool and a lot easier to use and place. Div tags are placed into html body using the <div></div> tags. You can name them, give them classes, give them ID's, the latter two of which you can put into CSS. div.name = a class of div tagsdiv#name = an ID of div tags. I'm not sure on the differences between them, but they offer the same practicality for the most part. Now, giving them classes means you can place them wherever you like. Take a look at the CSS tutorials but it's relatively simple to place them anywhere on a page and even place div tags on top of div tags using the z-index.

CSS CODE#name{position: absolute;height: 100px;width: 100px;top: 300px;left: 400px;background-color: blue;}END CSS CODE

Anything with that ID attached will then follow these rules and be placed 'exactly' there, attaching a tag to the front of it say div#name, will make all div's with that ID follow those rules.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...