css from HTML

Discussion in 'CSS' started by kingshah, Jun 17, 2009.

  1. #1
    can someone PLEASE tell me the code for css for this HTML:

    <table cellspacing="0" cellPadding="0" width="1000" border="0">
    <tr>
    <td width="450" bgcolor="#FFFFFF" align="left"><img src="logo.jpg" alt="logo title"></td>
    <td width="550" align="center" bgcolor="#FFFFFF">Some TEXT. some text.</td>
    </tr>
    </table>
    Code (markup):
    thanks in advanced.
     
    kingshah, Jun 17, 2009 IP
  2. Caden Grant

    Caden Grant Active Member

    Messages:
    294
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    51
    #2
    Try this

    XHTML
    
    <div id="table">
    <div id="left"><img src="logo.jpg" alt="logo title" /></div>
    <div id="right">Some text</div>
    </div>
    
    Code (markup):
    CSS
    
    #table { width: 1000px; }
    #left { float: left; width: 450px; background-color: #ffffff; text-align: left; }
    #right { float: left; width: 450px; background-color: #ffffff; text-align: center; }
    
    Code (markup):
     
    Caden Grant, Jun 18, 2009 IP
  3. kingshah

    kingshah Peon

    Messages:
    9
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    thanks very much caden. works amazing :)
     
    kingshah, Jun 18, 2009 IP
  4. deathshadow

    deathshadow Acclaimed Member

    Messages:
    9,732
    Likes Received:
    1,999
    Best Answers:
    253
    Trophy Points:
    515
    #4
    I would probably approach that a bit differently...

    <div id="header">
    	<img src="logo.jpg" alt="logo title" />
    	<p>
    		Some TEXT. some text.
    	</p>
    <!-- #header --></div>
    
    Code (markup):
    and the CSS:
    #header {
    	overflow:hidden; /* wrap floats */
    	width:1000px; /* also trips haslayout, so floats are wrapped in IE 7/earlier */
    	background:#FFF;
    	text-align:center;
    }
    
    #header img {
    	float:left;
    }
    
    Code (markup):
    Though this makes a lot of assumptions (the image is 450px, etc, etc). I'm rabid about getting as much as possible out of the HTML and using as few unneccessary wrappers as possible.
     
    deathshadow, Jun 28, 2009 IP