ISTIAK Posted May 21, 2014 Share Posted May 21, 2014 Hey everyone i am a newbie in web develop anyone can tell me how to set table align in css?and th, td, tr also with table align i got stuck help me please ? thanks in advance Link to comment Share on other sites More sharing options...
davej Posted May 21, 2014 Share Posted May 21, 2014 Don't use the table align attribute or any other obsolete table attribute. Use CSS to style a table... http://www.w3schools.com/css/css_table.asp Link to comment Share on other sites More sharing options...
ISTIAK Posted May 22, 2014 Author Share Posted May 22, 2014 in css how can i align a table? crying... Link to comment Share on other sites More sharing options...
davej Posted May 22, 2014 Share Posted May 22, 2014 Align a table -- what does that mean? Did you look at the tutorial examples? Link to comment Share on other sites More sharing options...
lovewebdesign Posted May 27, 2014 Share Posted May 27, 2014 Don't use the table align attribute or any other obsolete table attribute. Use CSS to style a table... http://www.w3schools.com/css/css_table.asp I agree with davej, using table align attribute is harmful for your SEO, it is out dated, we should avoid using it. Link to comment Share on other sites More sharing options...
Wolverine Posted May 28, 2014 Share Posted May 28, 2014 (edited) I think he is having the same problem that I am. On the index page of my home page I have a table with some javascript for sending me email. The code looks like this: <code> < center> < table> <!--border="5"--> <tbody> <tr> <td> <font size="+2"> <script type="text/javascript"> <!-- // var Domain = "*******.net" var Mailme = "mail" + "to:" + "*.********@" + Domain document.write( "<FORM>"); document.write( "<INPUT TYPE="submit" VALUE="Send me some email" "); document.write( "onClick="parent.location=Mailme"> "); document.write( "<FORM>"); // --> </script></font><form><font size="+2"><input value="Send me some email" onclick="parent.location=Mailme" type="submit"> <a>Mark's E-Mail </a> </font></form> </td> </tr> </tbody> </ table> </ center> </code> Now how to align it with CSS and get rid of the CENTER tags is my question. Edited May 28, 2014 by Wolverine Link to comment Share on other sites More sharing options...
davej Posted May 29, 2014 Share Posted May 29, 2014 You need to get rid of the center and font tags and also the document.write. Why do you have Javascript to duplicate the HTML? Also, you have a table and a form but you've only shown the code for one row? Why do you need a table? Why do you need a form? Link to comment Share on other sites More sharing options...
Wolverine Posted May 29, 2014 Share Posted May 29, 2014 (edited) It is a contact form on my Index.html that was originally developed when I was on another ISP by someone who was doing a FREE PERSONAL WEBSITE SPECIAL to get customers. I think they are out of Business now as I can't find them anymore. I have managed to convert everything else over to HTML5 and CSS but this is where I am stuck. You asked and I quote"Align a Table what does that mean?" I am giving an example of what that means. Here is the html code for my index page and the url as well: <!DOCTYPE html><html><head><link href="marksplace.css" rel="stylesheet" /><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><meta name="description" content="My personal Homepage and Interests"><meta name="keywords" content="Personal Homepage,Sci-fi,NEVERWINTER NIGHTS,Civil War,science fiction"><style>table,td,th{border:5px solid transparent;text-align:center;}td{height:50px;vertical-align:top;}body{background-image:url('starback.jpg'); }img { border: 0; }body{background-color:black; color:white; line-height:200%;}</style><title>Mark's Place</title><!-- this document was created by Phoenix Productions --></head><img src="markpl.jpg" width="199" height="198" alt=""><h1 style="text-align:center; color:gold;">Introduction</h1><ul><li style="list-style-type:none;"> Hi, my name is Mark Nelson and I am a Trekker, I am interested in Star Trek, Star Wars, Science Fiction Books, Movies and TV Shows, and NEVERWINTER NIGHTS . If you are a Trekker please come here and let's stay in touch.<p> </p></li></ul><!--<center><b><font size="+2">Hobbies and Interests</font></b></center>--><h2 style="text-align:center;">Hobbies and Interests</h2><p>My Hobbies are computers, reading Science Fiction Books, playing NEVERWINTER NIGHTS and the Internet. I hope all the fans of StarTrek and NEVERWINTER NIGHTS will come here and tell me how they like mysite. Livelong and Prosper!</p><h3>CATS</h3><p>I bought a cat back in October of last year. She is cute, frisky and a very active cat.</p><p><img style="float:right;" src="ncc1701d.jpg" alt="Starship Enterprise NCC1701D"> </p><!--<center></center> <center> </center>--> <a style="color:yellow;" href="http://home.comcast.net/%7Em.nelson10/page2.htm">page2.htm</a> <center><table> <!--border="5"--><tbody><tr><td><font size="+2"><script type="text/javascript">//<!--var Domain = "comcast.net"var Mailme = "mail" + "to:" + "m.nelson10@" + Domaindocument.write("<FORM>");document.write("<INPUT TYPE="submit" VALUE="Send me some email" ");document.write("onClick="parent.location=Mailme"> ");document.write("<FORM>");// --></script></font><form><font size="+2"><input value="Send me some email" onclick="parent.location=Mailme" type="submit"> <a>Mark's E-Mail</a> </font></form></td></tr></tbody></table></center><img src="counter.png" alt="counter.png"><!--<center><i>This page was created by Phoenix Productions, Inc.</i></center><center><i>Phoenix Productions, Inc. © 1996.</i></center>--><!-- This shows the user the last date this page was modified --><center></center><br><br></body></html> Edited May 29, 2014 by davej Link to comment Share on other sites More sharing options...
kelly2marie Posted May 29, 2014 Share Posted May 29, 2014 (edited) Hey everyone i am a newbie in web develop anyone can tell me how to set table align in css?and th, td, tr also with table align i got stuck help me please ? thanks in advance Are you looking to center the table? If so, the best way to do that is to wrap the table with a div tag and center that div tag with CSS. (give the div a width and auto margins for the left and right) Are you looking to align text? In a certain cell? such as th (table header) or tr (table row) or td (table cell)? Use the CSS text-align property with an appropriate selector. So you may want to begin by learning about CSS Selectors and how to use them. You could possibly give your table an id..... meaning an id selector. This helps provide specificity in your css styles. Ex: <table id="admins"> .....etc. Of course, you name the id, then create the selector to apply to the table with that id selector. Ex <table id="admins"> </table> your CSS would look like: #admins {width: 800px; border: 1px solid #333; background-color: #cdcdcd;} <-- this style targets the table with the id of "admins". Now when you want to style the cells, rows, header etc of the table, you will begin your selectors with #admins followed by a tag selector that targets th, td, tr, or any of the other possible table elements. Ex Let's style the table header <th></th> #admins th {......} Style the table row with ... #admins tr {......} You can also add classes to style rows differently or columns differently. For instance, style the first row of the admins table so that the background is different from the rest of the rows ..... 1. Create a class style: .light-color {background-color: #f6f6f6;} 2. Next, add class="light-color" to the <tr> element in the html.... <tr class="light-color"> Now whatever background color you assign to .light-color will be applied anywhere you use the class "light-color". Hope this gives you a better understanding. Go through w3Schools CSS tutorials to learn more. Edited May 29, 2014 by kelly2marie Link to comment Share on other sites More sharing options...
Wolverine Posted May 29, 2014 Share Posted May 29, 2014 Thank you Kelly2Marie I was looking to center the table but the things I could find about alignment were for within the table. Link to comment Share on other sites More sharing options...
davej Posted May 29, 2014 Share Posted May 29, 2014 Maybe look at this version... <!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="description" content="My personal Homepage and Interests"><meta name="keywords" content="Personal Homepage,Sci-fi,NEVERWINTER NIGHTS,Civil War,science fiction"><title>Mark's Place</title><link href="marksplace.css" rel="stylesheet" /><style>body{background-image:url('starback.jpg'); background-color:black; color:white; line-height:200%;}#wrap{width:80%;/*text-align:center;*/margin:0 auto;}#footer{/*border:1px solid #222;*/text-align:center;float:none;clear:both;}h1,h2,h3{/*color:gold;*/text-align:center;}h1{color:gold;}h2.inline1{color: #555;font-family:serif;font-weight:bold;font-size:18pt;display:inline-block;margin:3px 5px;}img { border:none; }li{list-style-type:none;}a.yellow{color:yellow;}.cent{text-align:center;}</style><script>function sendmail(){var Domain = "*******.net";window.location = "mailto:" + "*.********@" + Domain;}</script></head><body><div id="wrap"><div class="cent"><img src="markpl.jpg" width="199" height="198" alt="markpl.jpg"></div><h1>Introduction</h1><p>Hi, my name is Mark Nelson and I am a Trekker, I am interested in Star Trek, Star Wars, Science Fiction Books, Movies and TV Shows, and NEVERWINTER NIGHTS . If you are a Trekker please come here and let's stay in touch.</p><h2>Hobbies and Interests</h2><p>My Hobbies are computers, reading Science Fiction Books, playing NEVERWINTER NIGHTS and the Internet. I hope all the fans of Star Trek and NEVERWINTER NIGHTS will come here and tell me how they like mysite. Livelong and Prosper!</p><h3>CATS</h3><p>I bought a cat back in October of last year. She is cute, frisky and a very active cat.</p><img style="float:right;" src="ncc1701d.jpg" alt="ncc1701d.jpg" title="Starship Enterprise NCC1701D"/><a class="yellow" href="http://home.comcast.net/%7Em.nelson10/page2.htm">Page 2</a><br><div id="footer"><input type="button" value="Send me some email" onclick="sendmail()"/> <h2 class="inline1">Mark's E-Mail</h2> </div><br/><div class="cent"><img src="counter.png" alt="counter.png"/></div></div></body></html> Link to comment Share on other sites More sharing options...
ISTIAK Posted June 21, 2014 Author Share Posted June 21, 2014 hmm thanks everyone Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now