Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Floating DIV

Posted on 2014-01-30
10
Medium Priority
?
384 Views
Last Modified: 2014-01-30
I have 2 divs that float side by side. I want the div on the right side to be able to expand down if the content is wider than the div.

Current for some reason the div expands but it goes under the div on the right, and I want to keep the div on the same place.

Something like this.
*-----------------------*
* DIV 1   --   DIV 2 *
*-------------   DIV 2 *
                 *  DIV 2 *
                 * ---------*
0
Comment
Question by:Medrise
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 4
10 Comments
 
LVL 58

Expert Comment

by:Gary
ID: 39821959
Not sure what you mean. How does your code differ from this
http://jsfiddle.net/5UvY9/
0
 

Author Comment

by:Medrise
ID: 39822036
Its something like that but I have this on my code

<div id="main" class="left">
    <div class="left">
           Div 1
    </div>
    <div class="wrap left">
           <div class="left">
                  Div 2
           </div>
           <div class="left">
                  Div 3 <br/>
                  Div 3 <br/>
                  Div 3 <br/>
           </div>
    </div>
</div>

Open in new window


Div 3 goes under the div2
0
 
LVL 58

Expert Comment

by:Gary
ID: 39822053
And what css do you have?
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 

Author Comment

by:Medrise
ID: 39822074
Here is all the css and code

<div class="clearCSS prodDisplay">
	<div class="subGroup left">
		<div class="icon left">
			ICON
		</div>
		<div class="left smallPaddingLeft">
			INPUT
		</div>
		<div class="left medPaddingLeft smallPaddingRight">
			LINK
		</div>
		<div class="partNumandDesc left">
			<div class="medPaddingLeft partNumber left">
				DIV 1
			</div>
			<div class="prodDesc left">
				DIV 2<br/>
				DIV 2<br/>
				DIV 2<br/>
				DIV 2<br/>
				DIV 2<br/>
			</div>
		</div>
		<div class="left extraPaddingRight">
			some text
		</div>
		<div class="left leadTime medPaddingLeft">
			some text
		</div>
	</div>
</div>



.prodWrap {
	margin: 0;
}
.prodWrap .spacing {
	margin: 0 38px 0 38px;
}
.prodWrap .shippingLocation {
	text-align: right;
	font-weight: bold;
}
.prodWrap .header {
	width: 89%;
	margin-left: 32px;
	padding: 5px 25px 5px 25px;
	border-bottom:1px solid #990000;
	border-top:1px solid #990000;
}
.prodWrap .centerText {
	text-align: center;
}
.prodWrap .left {
	float: left;
}
.prodWrap .nomargin {
	margin-left: -15px;
}
.prodWrap .headerText {
	font-weight: bold;
	font-size: 12px;
}
.prodWrap .smallPaddingRight {
	padding-right: 10px;
}
.prodWrap .smallPaddingLeft {
	padding-left: 10px;
}
.prodWrap .medPaddingRight {
	padding-right: 20px;
}
.prodWrap .medPaddingLeft {
	padding-left: 20px;
}
.prodWrap .largePaddingRight {
	padding-right: 430px;
}
.prodWrap .extraPaddingRight {
	padding-right: 45px;
}
.prodWrap .clearCSS {
	clear: both;
}
.prodWrap .prodDisplay {
	padding-left: 32px;
}
.prodWrap .prodDisplay .subGroup {
	width: 980px;
	padding-top: 5px;
	padding-bottom: 5px;
}
.prodWrap .prodDisplay .subGroup .icon {
	margin: 0 auto;
	width: 30px;
}
.prodWrap .prodDisplay .subGroup .partNumandDesc .partNumber {
	font-size: 12px;
	font-weight: bold;
}
.prodWrap .prodDisplay .subGroup .partNumandDesc .prodDesc {
	font-size: 13px;
}
.prodWrap .prodDisplay .subGroup .leadTime {
	font-size: 12px;
}
.prodWrap .prodDisplay .subGroup .partNumandDesc {
	min-width: 630px !important;
	max-width: 630px !important;
}

Open in new window

0
 

Author Comment

by:Medrise
ID: 39822085
It works on JSFiddle must be some other css override.
0
 
LVL 58

Expert Comment

by:Gary
ID: 39822091
You are targeting those divs starting with an element that has a class prodWrap - but your code doesn't have an element with that class.
Wrap the html in a div with that class and your css will work fine.
http://jsfiddle.net/GaryC123/5UvY9/2/

At least I assume this is what you are looking for.
0
 

Author Comment

by:Medrise
ID: 39822146
I added that... it was missing on the code here... but the problem is that you have the <br/> after each text... and I don't have that on the original text... if I add the <br> it works. but I don't know how long the text is.
0
 

Author Comment

by:Medrise
ID: 39822167
Here is an example.
http://jsfiddle.net/5UvY9/3/
0
 
LVL 58

Accepted Solution

by:
Gary earned 2000 total points
ID: 39822220
That's how div's work - they will take the maximum space they can (when floated) upto the width of the container, even if that means moving the whole div down.
To fix is it you need to give the div a max-width attribute, See in the example here
http://jsfiddle.net/GaryC123/5UvY9/4/
0
 

Author Comment

by:Medrise
ID: 39822256
Oh, ok... I got it now... that fixed... thanks :)
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes how to create custom column layout styles for Bootstrap. The article uses 5 columns to illustrate the concept, but the principle can be extended to any number of columns.
Use these top 10 tips to master the art of email signature design. Create an email signature design that will easily wow recipients, promote your brand and highlight your professionalism.
In this tutorial viewers will learn how to embed videos in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <video> tag to insert a video. Define the src as the URL of your video; this is similar to …
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

609 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question