Results 1 to 6 of 6

Thread: Table using printf (HTML, PHP, CSS, Help) [Resolved]

  1. #1

    Thread Starter
    Retired G&G Mod NoteMe's Avatar
    Join Date
    Oct 2002
    Location
    @ Opera Software
    Posts
    10,190

    Table using printf (HTML, PHP, CSS, Help) [Resolved]

    I am writing out a table like this:

    PHP Code:
    <table id="overskriften" height="5px" padding="0" margin="0" valign="bottom">
                        <?
                        printf("<tr><td>%s</td><td>%s</td></tr>\n",$Overskrift, $Dato);
                        ?>
                        </table>
    Don't mind all the "properties" I have on it right now, I have tried setting every "propert" I know but still FireFox makes a big table, and IE a small one. I have added a red box around the div so you can see what I mean...

    Here is the CSS:

    Code:
    #overskriften{
    	width:340px;
    	height:3px;
    	border:0;
    	cellpadding:0;
    	cellspacing:0;
    	margin: 0;
    	padding: 0;
    	background: red;
    	valign: bottom;
    }
    You can find the site here...

    http://www.klubbscenen.com/klubbny/index2.php

    what am I doing wrong.....
    Last edited by NoteMe; Apr 26th, 2004 at 01:00 PM.

  2. #2

    Thread Starter
    Retired G&G Mod NoteMe's Avatar
    Join Date
    Oct 2002
    Location
    @ Opera Software
    Posts
    10,190
    I made it, I made it, I made it...


    I found out that the text in the table had two HTML tags to make it vold and change the font. When I took them away, it worked, and now I have them back, and it still works......but as long as it is working I am happy...

  3. #3
    VBA Nutter visualAd's Avatar
    Join Date
    Apr 2002
    Location
    Ickenham, UK
    Posts
    4,906
    On first looking at the source code I've noticed you are mixing HTML formatting attributes with CSS formatting attributes.

    This is one of the worst possible things you could do. It confuses IE no end and it makes the page confusing to read and debug too. What I suggest you do is start the style sheet again and take all HTML formatting properties out.

    Here's some sample code to show you what I mean. This will produce something similar to your small table in your page and works in both IE and Firefox. As you can see all formatting is in the style sheet. If you want to override the formatting for an individual tag use the style atrribute as the CSS specification requires that any styles in the style attribute should override the style sheet styles.
    Code:
    <html>
    	<head>
    		<style type="text/css">
    #small_table {
    	width: 340px;
    	height: 30px;
    	border: 0px;
    	padding: 0px;
    	border-collapse: collapse;
    }
    
    #small_table td {
    	font-size: 0.7em;
    	font-family: Verdana;
    	font-weight: bold;
    	padding: 2px;
    	border: 3px solid blue;
    }
    
    #small_table .tdright {
    	text-align: right;
    }
    		</style>
    	</head>
    	<body>
    		<table id="small_table">
    			<tr>
    				<td>Text Here</td>
    				<td class="tdright">Right Aligned</td>
    			</tr>
    			<tr>
    				<td style="font-weight: normal">This text has had its style overridden</td>
    				<td class="tdright">Right Aligned</td>
    			</tr>
    		</table>
    	</body>	
    </html>
    PHP || MySql || Apache || Get Firefox || OpenOffice.org || Click || Slap ILMV || 1337 c0d || GotoMyPc For FREE! Part 1, Part 2

    | PHP Session --> Database Handler * Custom Error Handler * Installing PHP * HTML Form Handler * PHP 5 OOP * Using XML * Ajax * Xslt | VB6 Winsock - HTTP POST / GET * Winsock - HTTP File Upload

    Latest quote: crptcblade - VB6 executables can't be decompiled, only disassembled. And the disassembled code is even less useful than I am.

    Random VisualAd: Blog - Latest Post: When the Internet becomes Electricity!!


    Spread happiness and joy. Rate good posts.

  4. #4

    Thread Starter
    Retired G&G Mod NoteMe's Avatar
    Join Date
    Oct 2002
    Location
    @ Opera Software
    Posts
    10,190
    Most of the HTML editing I have in the code is for testing. I have a big CSS file belive me, but we are testing everything in

    Mozilla
    IE
    FireFox
    Opera
    Safari

    and things are not always working in all the browsers. Like Safari don't understand when I write

    Code:
    body {
    	background-color: #5E89BD;
    }
    in CSS. I have no idea why, but thats why we are setting things like that in HTML. I started out with everythig in CSS, and more and more of the things are getting back in HTML so all the browsers can read it.....**** the standards....my teacher would kill me, but HEY at least it works.

    BTW thanks for the sameple code. I will have a look at it, and see if it is worth recoding, or if will just use it next time,...


    ØØ

  5. #5
    VBA Nutter visualAd's Avatar
    Join Date
    Apr 2002
    Location
    Ickenham, UK
    Posts
    4,906
    I try and keep right away from using HTML formatting where possible if I use CSS. The reasons being is (I'm referring to IE) it can cuase the websites to break as they just randomly choose which style properties to apply. With HTML formatting however it is up to the browser how it is formatted - where as in CSS it it is up to you
    PHP || MySql || Apache || Get Firefox || OpenOffice.org || Click || Slap ILMV || 1337 c0d || GotoMyPc For FREE! Part 1, Part 2

    | PHP Session --> Database Handler * Custom Error Handler * Installing PHP * HTML Form Handler * PHP 5 OOP * Using XML * Ajax * Xslt | VB6 Winsock - HTTP POST / GET * Winsock - HTTP File Upload

    Latest quote: crptcblade - VB6 executables can't be decompiled, only disassembled. And the disassembled code is even less useful than I am.

    Random VisualAd: Blog - Latest Post: When the Internet becomes Electricity!!


    Spread happiness and joy. Rate good posts.

  6. #6

    Thread Starter
    Retired G&G Mod NoteMe's Avatar
    Join Date
    Oct 2002
    Location
    @ Opera Software
    Posts
    10,190
    In my experience these two three weeks it's more like. "IE uses what CSS when it wants it, when it feels like it want it....." and it irritates the but out of me.....as I said, the site started as plain CSS. But as long as IE or some other browser don't want to look at it the same way ass the standard, the solution for me is most often to move it out in the HTML tags...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width