user1943618
user1943618

Reputation:

image box horizontally alignment

how to make the red box horizontally aligned i gave display inline property to the imageBox class but its not working

providing my code below

<div class="imageBox"></div>
            <div class="imageBox"></div>
            <div class="imageBox"></div>
            <div class="imageBox"></div>
            <div class="imageBox"></div>
            <div class="imageBox"></div>
            <div class="imageBox"></div>
            <div class="imageBox"></div>
            <div class="imageBox"></div>
            <div class="imageBox"></div>

http://jsfiddle.net/VXXPC/7/

Upvotes: 0

Views: 2218

Answers (2)

Jefferson
Jefferson

Reputation: 993

I believe the display:inline; function is only for list items.

The best solution to make them display in a line, is to wrap them in a div, then give every box div a float:left;

HTML:

<div id="ImageBox_wrapper> 
   <div class="ImageBox></div>
   <div class="ImageBox></div>
   <div class="ImageBox></div>
   <div class="ImageBox></div>
   <div class="ImageBox></div>
   <div class="ImageBox></div>
</div>

CSS:

.ImageBox {
border:1px solid red;
width: 30px;
height: 30px;
float: left;

If that doesn't work you can try adding a position:relative; to your .ImageBox css

position:relative;

Upvotes: 1

isherwood
isherwood

Reputation: 61063

.imageBox {display: inline-block;}

http://jsfiddle.net/VXXPC/13/

Upvotes: 0

Related Questions