• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 309
  • Last Modified:

Text wrapping independently around 4 different divs containing images.....

I have a page that will have (among other things) a container div that contains a group of 4 images (floating left), with text that can wrap around the images.

I have 4 images, and I am pretty sure I want each image and wrapping text in its own div, because I don't want the text associated with one image to continue wrapping around the next image.

Twitter-Bootstrap responsive.

In  other words, I want each image and associated text to be in its own independent world.

Attached is a mockup of what I want it to look like, with one container div wrapping around the whole thing.

I think my ugly mockup pretty much explains what I want to do.

And I am looking to your expert suggestions on the best way to do this.

Thanks

Rowby
MockupThe red "dash" around the outside is not supposed to be a graphic. It's just supposed to be a div -- but my graphic editing program made it look like a graphic.
0
Rowby Goren
Asked:
Rowby Goren
  • 6
  • 5
1 Solution
 
Scott Fell, EE MVEDeveloperCommented:
img_float_left{
   float:left;
   margin-right:5px;
   margin-bottom:5px;
}

Open in new window

<div class="container">

  <div class="row">
       <div class="col-xs-12"><img src="myimage" class="img_float_left">text text text</div>
    </div>
<div class="row">
       <div class="col-xs-12"><img src="myimage" class="img_float_left">text text text</div>
    </div>
<div class="row">
       <div class="col-xs-12"><img src="myimage" class="img_float_left">text text text</div>
    </div>
<div class="row">
       <div class="col-xs-12"><img src="myimage" class="img_float_left">text text text</div>
    </div>
<div class="row">
       <div class="col-xs-12"><img src="myimage" class="img_float_left">text text text</div>
    </div>
</div>

Open in new window

0
 
Scott Fell, EE MVEDeveloperCommented:
This is how that could look http://jsbin.com/UpiMIjoC/2/edit?html,output

The css above needs to be fixed by adding a dot before the class name.
.img_float_left{
   float:left;
   margin-right:5px;
   margin-bottom:5px;
}

Open in new window

0
 
Rowby GorenAuthor Commented:
Thanks!  Is the <div class="col-xs-12">  related to it being twitter bootstrap?
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
Scott Fell, EE MVEDeveloperCommented:
Yes >  http://getbootstrap.com/css/#grid

There are 12 columns in the grid.  It is meant to make designing a responsive site easier.  However, making a responsive site takes more planning.  The code below will create 2 rows of "stuff" on a phone, and 2 equal columns side by side for screens larger than I think 768px.

<div class="row">
<div class="col-xs-12 col-sm-6">stuff</div>
<div class="col-xs-12 col-sm-6">stuff</div>
</div>

Open in new window


Read through the css link and look at how they did some examples http://getbootstrap.com/getting-started/#examples
0
 
Rowby GorenAuthor Commented:
Perfect!  Looks great on desktop and mobile.

Thanks!

Rowby
0
 
Rowby GorenAuthor Commented:
Hmmmm

Actually looking it now at Cell landscape, it doesn't quite lay out.

In a minute I'll upload a screen shot of mobile.  

I'm sure it's an easy css fix.
0
 
Rowby GorenAuthor Commented:
Hi

Here's a screen capture of cell and pretty much the same on tablet.  Looks fine on desktop

I have a separate css that kicks in for cell and tablet.

Here's the css for cell and tablet:

/*  Home Page */
  .img_float_left {
   float:left;
   margin-right:5px;
   margin-bottom:15px;
}
    .row{margin-bottom:15px;

}

div.NewsEventscontainer {
  margin-right: 15px;
   margin-top: 30px
  
}

/* Home Page */

Open in new window


and HTML  (edited for privacy)
<div class="NewsEventscontainer">
	<div class="row">
		<div class="col-xs-12">
			<img class="img_float_left" src="images/stories/image1.jpg" />
			<h3>
				Welcome </h3>
			<p>
				Content content text content . <a href="index.php?option=message-from-the"&amp;catid=37&amp;Itemid=227" target="_self">MORE</a></p>
		</div>
	</div>
	<div class="row">
		<div class="col-xs-12">
			<img class="img_float_left" src="images/image2.jpg" />
			<h3>
				Professor Awarded Book Award for AMS</h3>
			<p>
				Professor was awarded the most coveted prize. <a href="index.php?option=com_cont&amp;view=article&amp;catid=2228&amp;id=128">MORE</a></p>
		</div>
	</div>
	<div class="row">
		<div class="col-xs-12">
			<img class="img_float_left" src="images/image3.png" />
			<h3>
				Popular music musicologist </h3>
			<p>
				Professor blogs about  Society. <a href="http://net.latimes.com">MORE</a></p>
		</div>
	</div>
	<div class="row">
		<div class="col-xs-12">
			<img class="img_float_left" src="images/stories/image4.jpg" />
			<h3>
				Music Graduate Student performs</h3>
			<p>
				In conjunction this immersive art and sound experience. <a href="http://www.cnn.com/" target="_self">MORE</a></p>
		</div>
	</div>
</div>

Open in new window


Tablet and phone
Thanks!
0
 
Scott Fell, EE MVEDeveloperCommented:
Did you get it figured out?

If all the pics have the same height and are not responsive, then make all the class rows a minimum height.

Let's say the pics are each 100px tall. Try making a min height of 120px;.

<div class="row">

should be
<div class="row pic_row">

Then add css
.pic_row{min-height:120px;}
0
 
Rowby GorenAuthor Commented:
Hmmmm

The page doesn't seem to be picking up on the new css:

LInk to page

  .img_float_left {
   float:left;
   margin-right:5px;
   margin-bottom:15px;
}
    .row{margin-bottom:15px;

}

div.NewsEventscontainer {
  margin-right: 15px;
   margin-top: 30px;
  
}

.pic_row {
  min-height:160px;
} 

Open in new window


Thanks!

ROwby
0
 
Scott Fell, EE MVEDeveloperCommented:
The page looks fine.

Make sure the custom css is the last css loaded.
0
 
Rowby GorenAuthor Commented:
Yes  and it look fine on mobile.

Case closed!

:)
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

  • 6
  • 5
Tackle projects and never again get stuck behind a technical roadblock.
Join Now