0

I have a div on my page that should have some small divs inside it, with a line of text, images and another line of text, everything centered.
But by some weird reason, the div doesn't wrap around the text even if floated, it looks like it haves the same width as the full-scale image, instead of wrapping around the now smaller image.

<div id="real">
<div class="relspn">
Title:<br/>
<img src="img.png"/><br/>
Another text
</div>
<div class="relspn">
Title:<br/>
<img src="img.png"/><img src="img.png"/><br/>
Another Text Another Text
</div>
</div>

Something like that, but, it doesnt matter if I float the divs, set them as inline-blocks or even inline, the div doesn't gets smaller than the full image.

Here's the css:

#real {
    float: right;
    position:relative;
    width:96%;
    padding:20px 0;
}

.relspn {
    position:relative;
    text-align:center;
    float:left;
    padding:0.2%;
}

.relspn img {
    position:relative;
    display:inline;
    width:10%;
}

I don't know what's happening, help.

Edit:
http://jsfiddle.net/3SkZV/1/
Updated now, I wrote the div class wrong in the example. >.>
Updated the Fiddle too

Miguel Vieira
  • 144
  • 3
  • 17
  • 2
    I don't understand what you're trying to do. I created a fiddle with your demo code, though. – Jared Farrish Jul 24 '14 at 00:24
  • 1
    I don't understand either – Andrew Liu Jul 24 '14 at 00:26
  • Sorry, I had typed "realpsn" instead of "realspn" in the example, but my problem isn't solved. – Miguel Vieira Jul 24 '14 at 06:25
  • I did not understand the question.Could you please explain it more clearly so that we can help.What are you actually trying to do .. – Sunil Hari Jul 24 '14 at 09:47
  • Well, I fixed it by resizing the images on an image editing program, but the curiosity remained. I was trying to have some images of the creator and supporters of an event, over the creator, was to be written "creator" and under the logo, it's name. Over the supporters I needed to be written "supporters" and under their logos it was supposed to be their names. But I can't understand why the div didn't wrap around the text if the image was smaller than the div, it looked like the div was wrapping around the image, then resizing the images and leaving the div as it was. – Miguel Vieira Aug 04 '14 at 18:45

0 Answers0