Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    Regular Coder
    Join Date
    Oct 2009
    Location
    GERMANY
    Posts
    139
    Thanks
    29
    Thanked 1 Time in 1 Post

    problem with this box

    Hey guys,

    so I am planning to make this:



    This is the file:

    PHP Code:
    <div id="topstorycont">

        <
    div id="topstory">
            <
    div id="number">
                
    1
            
    </div>
            
            <
    div id="previmage">
                <
    a href="http://www.blablabla.de/2010/12/nur-noch-3-tage-kostenloses-girokonto-bei-netbank-mit-60-eurp-pramie-bekommen/"  target="_blank"><img src="http://www.blablabla.de/wp-content/themes/blocks/images/preview/previmage1.PNG" alt="" </></a>
            </
    div>
            <
    div id="prevlink"
                <
    a href="http://www.blablabla.de/2010/12/nur-noch-3-tage-kostenloses-girokonto-bei-netbank-mit-60-eurp-pramie-bekommen/"  target="_blank">Gratis Netbank Girokonto 60 Euro</a>
            </
    div>
        </
    div>
        
    </
    div
    The CSS Data:

    PHP Code:
    #topstorycont {
        
    width304px;
        
    border-top1px solid #DDDDDD;
        
    border-bottom1px solid #FFFFFF;
        
    margin-top:10px;
    }    

    #topstory {
        
    width304px;
    }

    #number {
        
    width:54px;
        
    height:52px;
        
    background-color:#DDDDDD;
        
    font-size:30px;
        
    font:ArialHelveticasans-serif;
        
    font-weight:bold;
        
    color:#FFFFFF;
    }

    #previmage {
        
    floatleft;
        
    width:92px;
        
    height:52px;
        
    }

    #prevlink {
        
    float:left;
        
    width:100px;
        
    height:52px;
        
    padding-left:10px;

    Somehow it does not appear the way I want it. This is how it looks:



    Help needed!
    Attached Thumbnails Attached Thumbnails problem with this box-example.jpg   problem with this box-example2.jpg  
    Last edited by Fou-Lu; 01-20-2011 at 03:28 AM.

  • #2
    Senior Coder
    Join Date
    Aug 2010
    Location
    High Point, NC
    Posts
    3,338
    Thanks
    5
    Thanked 363 Times in 360 Posts
    Did you try left margins on the previewImage and previewLinks to bump them to the right?

    When you float an element left, the next element must also have a left margin at least the width of the element to the left of it.

  • #3
    Regular Coder
    Join Date
    Oct 2009
    Location
    GERMANY
    Posts
    139
    Thanks
    29
    Thanked 1 Time in 1 Post
    Quote Originally Posted by teedoff View Post
    Did you try left margins on the previewImage and previewLinks to bump them to the right?

    When you float an element left, the next element must also have a left margin at least the width of the element to the left of it.
    thanks for the tip, totally forgot. however, it just moved the image and the link to the right, still under the box "1".

  • #4
    Regular Coder
    Join Date
    Oct 2009
    Location
    GERMANY
    Posts
    139
    Thanks
    29
    Thanked 1 Time in 1 Post
    Ah got now, one more question, can you tell me how to get the number in the center and change the font?

  • #5
    Master Coder Excavator's Avatar
    Join Date
    Dec 2006
    Location
    Alaska
    Posts
    9,675
    Thanks
    22
    Thanked 1,827 Times in 1,811 Posts
    Hello OGGordon,
    image and link are under "1" because you don't float it. You have 3 items that you want side by side but only float 2 of them.

    Look at this -
    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Untitled Document</title>
    <style type="text/css">
    #topstorycont { 
        width: 304px; 
        border-top: 1px solid #DDDDDD; 
        border-bottom: 1px solid #FFFFFF; 
        margin-top: 10px; 
    }  
    #topstory { 
        width: 304px; 
    } 
    #number {
    	height: 52px;
    	width: 54px;
    	float: left;
    	background: #ddd;
    	font: bold 20px Arial, Helvetica, sans-serif;
    	color: #fff;
    } 
    #previmage { 
        height: 52px; 
        width: 92px; 
        float: left; 
         
    } 
    #prevlink { 
        height: 52px; 
        width: 100px; 
        float: left; 
        padding-left: 10px; 
    }
    </style>
    </head>
    <body>
        <div id="topstorycont"> 
            <div id="topstory"> 
                <div id="number"> 
                    1 
                </div>          
                <div id="previmage"> 
                    <a href="http://www.blablabla.de/2010/12/nur-noch-3-tage-kostenloses-girokonto-bei-netbank-mit-60-eurp-pramie-bekommen/">
                        <img src="http://www.blablabla.de/wp-content/themes/blocks/images/preview/previmage1.PNG" alt="" />
                    </a> 
                </div> 
                <div id="prevlink">  
                    <a href="http://www.blablabla.de/2010/12/nur-noch-3-tage-kostenloses-girokonto-bei-netbank-mit-60-eurp-pramie-bekommen/">
                        Gratis Netbank Girokonto + 60 Euro
                    </a> 
                </div>
            <!--end topstory--></div> 
        <!--end topstorycont--></div> 
    </body>
    </html>
    Last edited by Fou-Lu; 01-20-2011 at 06:02 AM.
    Validate often DURING development - Use it like a splelchecker | Debug during Development |Write it for FireFox, ignore IE
    Use the right DocType | Validate your markup | Validate your CSS | Why validating is good | Why tables are bad

  • #6
    Master Coder Excavator's Avatar
    Join Date
    Dec 2006
    Location
    Alaska
    Posts
    9,675
    Thanks
    22
    Thanked 1,827 Times in 1,811 Posts
    Or even this with a little less divitis -
    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Untitled Document</title>
    <style type="text/css">
    html, body {
    	margin: 0;
    	background: #f63;
    	font: 100% Arial, Helvetica, sans-serif;
    	color: #333;
    }
    #topstorycont {
        width: 304px; 
    	margin: 10px auto;
    	padding: 5px 0 20px;
    	background: #fff;
    }
    #topstory {
        border-top: 1px solid #ddd; 
    } 
    #number {
    	line-height: 50px;
    	width: 50px;
    	margin: 0;
    	float: left;
    	background: #ddd;
    	color: #fff;
    	font-size: 1.5em;
    	text-align: center;
    } 
    #previmage { 
        height: 50px; 
        width: 95px; 
        float: left;      
    } 
    #prevlink { 
    	margin: 5px 0 0 155px;
    	display: block;
    	font-size: 14px;
    }
    </style>
    </head>
    <body>
        <div id="topstorycont"> 
                <div id="topstory"> 
                    <h1 id="number">1</h1>          
                        <a href="http://www.blablabla.de/2010/12/nur-noch-3-tage-kostenloses-girokonto-bei-netbank-mit-60-eurp-pramie-bekommen/" id="previmage">
                            <img src="http://www.blablabla.de/wp-content/themes/blocks/images/preview/previmage1.PNG" alt="" />
                        </a> 
                    <a href="http://www.blablabla.de/2010/12/nur-noch-3-tage-kostenloses-girokonto-bei-netbank-mit-60-eurp-pramie-bekommen/" id="prevlink">
                        Gratis Netbank Girokonto + 60 Euro
                    </a> 
                <!--end topstory--></div> 
        <!--end topstorycont--></div>
    </body>
    </html>
    Last edited by Fou-Lu; 01-20-2011 at 06:03 AM.
    Validate often DURING development - Use it like a splelchecker | Debug during Development |Write it for FireFox, ignore IE
    Use the right DocType | Validate your markup | Validate your CSS | Why validating is good | Why tables are bad


  •  

    Posting Permissions

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