Best
Best

Reputation: 2318

Position 2 image tags next to each other

I´ve got the following images in a div:

 <div id="desc_attach_scroll">
    <img class="A" src="img/up.png" />
    <img class="B" src="img/down.png" />
 </div>

At the moment class B image is sitting vertically under class A image. I want to move B to the righthand side of A. I tried to float them but it didn´t work. Any suggestions?

Upvotes: 1

Views: 2300

Answers (3)

TLS
TLS

Reputation: 3150

If the width of Image A and Image B combined are too wide to fit into the width provided by the desc_attach_scroll container, no amount of flow-based css (in particular, floats) will get them to appear side by side. You can try using absolute positioning to get them next to each other, but that could cause you some serious headaches if the image widths ever change.

If Image A and Image B are not too wide for the space provided by the container, they should automatically flow next to each other without any special css rules applied.

Upvotes: 1

defau1t
defau1t

Reputation: 10619

You need to give width in order for float to work;

DEMO

Upvotes: 0

Scott
Scott

Reputation: 21882

Floats should work just fine.... See this Fiddle

Note.. if you use uppercase characters for class assignments, you must match the case for the stylesheet in most cases.

Upvotes: 2

Related Questions