Help with CSS

Discussion in 'CSS' started by vitoreis, Feb 5, 2010.

  1. #1
    Hello,

    I don't understand CSS very well, and I'm trying to add two columns to my footer. I can do it with tables but maybe you can help me doing in right way!

    First the code I have in footer:

    Image of my actual footer:
    [​IMG]

    Now as I wont it:
    [​IMG]

    Thank you,
    Vitor
     
    vitoreis, Feb 5, 2010 IP
  2. s_ruben

    s_ruben Active Member

    Messages:
    735
    Likes Received:
    26
    Best Answers:
    1
    Trophy Points:
    78
    #2
    You can do it like this:

    
    <div id="footer">
    <div style="padding-top:10px; float: left">image 1</div>
    <div style="padding-top:10px; float: right">image 2</div>
    <div style="padding-top:10px;">
    <span class="cr_text">powered_by</span>
    <a title="powered_by xxxxx1" href="www.xxxx.com"><small>XXXXXX</small></a>
    <div style="text-align: center; margin: 0 0 8px;" class="cr_text">design by xxxxxx</small></a></div>
    </div>
    </div>
    
    Code (markup):
     
    s_ruben, Feb 5, 2010 IP
  3. LeetPCUser

    LeetPCUser Peon

    Messages:
    711
    Likes Received:
    14
    Best Answers:
    0
    Trophy Points:
    0
    #3
    First and foremost, never use inline styles. The point of CSS is to have all the content in one CSS file so you can change something, footer for instance, with one file. By doing inline styles you are not utilizing CSS to it's maximum capacity.

    CSS File
    
    #leftFooterText
    {
     width:200px;
     height:30px;
     float:left;
    }
    
    #centerFooterText
    {
     width:400px;
     height:30px;
     float:left;
     text-align:center;
    }
    
    #rightFooterText
    {
     width:200px;
     height:30px;
     float:right;
    }
    
    Code (markup):
    HTML Code
    
     <div id="leftFooterText">put your button here</div>
    
     <div id="centerFooterText">put your disclaimer here</div>
    
     <div id="rightFooterText">put your button here</div>
    
    Code (markup):
    Note: this will have to be tweaked to match the width and height of your footer and you will have to play around with padding and margin. If you have any questions, feel free to PM me.
     
    LeetPCUser, Feb 5, 2010 IP
  4. vitoreis

    vitoreis Well-Known Member

    Messages:
    68
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    111
    #4
    Thank you both!

    Best of all: I understand how it woks!
     
    vitoreis, Feb 5, 2010 IP
  5. deathshadow

    deathshadow Acclaimed Member

    Messages:
    9,732
    Likes Received:
    1,999
    Best Answers:
    253
    Trophy Points:
    515
    #5
    Also, don't throw div's around elements that don't need div. Waste of markup.

    
    <div id="footer">
    	<img
    		src="images/image1.png"
    		alt="first image"
    		class="first"
    	/>
    	<img src="images/image2.png"
    		alt="second image"
    		class="second"
    	/>
    	<a href="www.xxxx.com"><span>powered_by</span>XXXXXX</a>
    	design by xxxxxx
    </div>
    
    Code (markup):
    Provides MORE than enough hooks for the CSS to do everything you are doing there. It's also a bad idea to waste time on 'title' when you can just put the entire text in the anchor; as a rule of thumb if you "need" title on an anchor, you have the wrong text in the anchor.
     
    deathshadow, Feb 6, 2010 IP