9 replies
  • WEB DESIGN
  • |
I offically hate tables...

And even more so in XHTML

I can't get these bad boys centered...

Code is currently --
**************************************************
<table width="600" height="200" border="0" style="border:dashed" bordercolor="#000000" align="center">
<tr>
<td height="188">
</td>
</tr>
</table>
**************************************************
I even tried adding <div align="center"></div>
Tags...

Nothing.

Strangely enough -- In IE everything is centered, but there is no border.

But in every other browser -- FF, Chrome etc -- there is a border but it is left aligned.

I am so confused right now as to how I can be having such different results...

If anyone can help I would be EXTREMELY grateful

JR
#tables #xhtml
  • Profile picture of the author VisualWebEffects
    use div's is better. like this:

    Style Sheet Class:

    Code:
    #centeredDiv {
    	width: 600px;
    	height: 188px;
    	text-align:center;
    	margin: auto;
    	border: 1px dashed black;
    }
    and the div html code:

    Code:
    <div id="centeredDiv">test content</div>
    Signature
    VisualWebEffects- Web Application Development, PC Software Development and Identity Design services
    {{ DiscussionBoard.errors[1518789].message }}
  • Profile picture of the author JRecard
    Awesome thanks -- Validator doesn't want me using div's at all.

    Perhaps thats just inline...

    That top code is for external CSS use I presume?

    Sorry - started learning HTML/XHTML yesterday

    Thanks for the help
    {{ DiscussionBoard.errors[1518806].message }}
  • Profile picture of the author VisualWebEffects
    you can put the css in between the <head> and </head> tags like so:
    Code:
    <style type="text/css">
    #centeredDiv {
    	width: 600px;
    	height: 188px;
    	text-align:center;
    	margin: auto;
    	border: 1px dashed black;
    }
    </style>
    or you can put it in an external file EG: styles.css and link it in the document (put this in between the <head> and </head> tags:

    <link href="styles.css" rel="stylesheet" type="text/css" />

    inside the styles.css you would have:

    Code:
    @charset "utf-8";
    
    #centeredDiv {
    	width: 600px;
    	height: 188px;
    	text-align:center;
    	margin: auto;
    	border: 1px dashed black;
    }
    Signature
    VisualWebEffects- Web Application Development, PC Software Development and Identity Design services
    {{ DiscussionBoard.errors[1518824].message }}
  • Profile picture of the author JRecard
    So why do I get from Validator

    "document type does not allow element "div" here; missing one of "object", "applet", "map", "iframe", "button", "ins", "del" start-tag"

    ??

    It doesn't like <div> tags? I have never had that problem before, with HTML - is it an XHTML thing?

    Side note -- what code is best for aligning images? I am using <img align ="center"> Which works on every browser except IE.. What would work in IE?

    EDIT: I didn't put in the URL because I am stupid But it seems to extend throughout the document -- so I thought it just might have been that you can not use <div> in XHTML or something. Obviously not

    URL -- www.thetwittertrade.com

    I am just spinning because I am getting so many different results from browsers that it is hard to know what I am doing wrong and hard to know what is right. One browser will have a problem - so I will change it and it will be fixed but, fixing it will cause a problem on another broswer.

    Anyway -- the code is messy as all hell atm and I am sorry for that

    Thanks

    JR
    {{ DiscussionBoard.errors[1520278].message }}
    • Profile picture of the author Karen Blundell
      post a URL..without looking at the code, we can only guess..if we see the code we can answer correctly
      Signature
      ---------------
      {{ DiscussionBoard.errors[1520323].message }}
  • Profile picture of the author JRecard
    Updated...

    Thanks Karen
    {{ DiscussionBoard.errors[1520375].message }}
  • Profile picture of the author VisualWebEffects
    i took a quick look at the url in your previous post. And i do me quick, and the one thing that hit me about the html is the fact that your using inline style sheets on about 95% of all your html elements.

    While inline styles are still supported, it is better design to put them in an external style sheet file (IE: styles.css). Then implement them using the class (IE .mystyle) or ID methods (IE: #mystyle). This way you can reduce your HTML Code overhead by combining styles that our the exact same.
    Signature
    VisualWebEffects- Web Application Development, PC Software Development and Identity Design services
    {{ DiscussionBoard.errors[1521800].message }}
  • Profile picture of the author JRecard
    I did actually start doing that today

    Your code which you gave me in the first post inspired me to start doing it...

    Which BTW worked AWESOME

    Thank you very much -- I have fixed most of the problems now, just need to change a couple more inline styles to external.

    Thanks again VisualWebEffects -- really appreciate it
    {{ DiscussionBoard.errors[1522203].message }}
  • Profile picture of the author VisualWebEffects
    no problem. glad i could be of assistance
    Signature
    VisualWebEffects- Web Application Development, PC Software Development and Identity Design services
    {{ DiscussionBoard.errors[1522430].message }}

Trending Topics