Jump to content

Div problems


MKGamer100

Recommended Posts

Hello everyone, this is my first post here and i need some help.

I am making a website about tanks. I am building her via PHP, CSS and HTML.

Now i made a div called lastnewstanks and css for that div is:

#lastnewstanks {	margin-left:8.5px;	margin-top:10px;	width:31.5%;	display:inline-block;	background-color:#222222;	height:300px;	color: #33CC33;}

My page displays 3 divs because i did this code:

$result = mysql_query("SELECT * FROM tanks ORDER BY ID DESC LIMIT 3");while($row = mysql_fetch_array($result))  {     $id = $row['id'];     $textforfun = $row['text'];     $image = $row['image'];     $title = $row['title'];echo "<div id='lastnewstanks'>";echo "<img src='$image' alt='' style='width:100%;height:45%'>";echo "<h4>$textforfun</h4>";echo "</div>";  }

But when i have different number of characters in that divs that div which have less number of characters go down.Sorry for my English but i'll put some images....2 images: One picture is with different number of characters, and other one is with same number...

post-183209-0-39403000-1429187356_thumb.png

post-183209-0-20927700-1429187427_thumb.png

Link to comment
Share on other sites

id singular to a page, class can be used multiple times within a page, using display: inline-block; makes these elements act like text, the default vertical alignment for text is baseline, and that is the rule it is following. To align at top use vertical-align: top;

  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...