user3423422
user3423422

Reputation: 23

CSS text starts a new line in float left

I'm getting little problem in arranging my elements while using css float left command it floats to the left and repeat the same thing on the next line but when any title with image is bigger the next entry goes to the next line and leaving space behind it which is really annoying for me

Here is my CSS

#main {
    width:100%;
    margin-top:55px;
    margin-left:45px;
margin-right:35px;
}
#body {
    float:left;
    margin-left:14px;
    margin-right:24px;
    alignment-adjust:central;
    margin-top:14px;
}
#tablealign {
    text-align:center;
    margin-top:20px;
}
#text {
    color:#333;
    text-decoration:none;
    font-size:12px;
    margin-top:12px;
    text-align:center;  
}
#image{
    margin-left:5px;
    alignment-adjust:central;
        text-align:center;
} 

HTML example code [Note I am using php for this]

<center><div id="body"><div id="tablealign"><a href="Videos.php?ID=345"><img  id="image" src=https://i1.ytimg.com/vi/8IpPx1vdJV8/maxresdefault.jpg width=200 height=150></a></div><div id="text"><a href="Videos.php?ID=345">GTA IV Lag Fix on Windows 7 -<br />
YouTube</a></div></div></center>

It appears like this Screen Shot of the page

Upvotes: 0

Views: 182

Answers (1)

Anass
Anass

Reputation: 2193

you need add to your #text id in css:

max-height:30px;
overflow:hidden;

this is an example : http://jsfiddle.net/pL79v/1/

Upvotes: 1

Related Questions