float

Content in floated divs causes div below to drop

I'm displaying WordPress posts horizontally using floated divs. I've got it working fine, but when the divs move to a new row, if the paragraph text inside each floated div is too long, the div immediately below it drops. Furthermore, each floated div is affected by the length of the divs above it. How do I make them flow naturally wit...

CSS IE6 float right

How come when I have a div style at display: block; float: right, in IE6 the div still goes under the text, and not in the middle of it just floated to the right. It works in all other browsers, including IE7+. I need to have display block because if i do display inline, then the menu inside the div is all messed up. .content { displa...

How to use float without flipping floated item and changing in source order? Is this possible ?

See this example to understand http://jsbin.com/ocewu This is code of example <style type="text/css" media="screen"> body { background-color: #000; font: 16px Helvetica, Arial; color: #fff; } div {width:300px;height:42px;border:2px solid red} a{border:2px solid blue;padding:10px} div a {float:right} #div2 a {float:left} </style> <...

Floats in CSS - Gap/space left on top when floated to the right?

This is a little difficult to describe, but basically there is undesired space left by a floated div on my page. Here are pictures describing the problem. The black boxes are divs. Before floating: After floating: Desired effect: And I'm not sure if it makes a difference, but I also have an empty div with "clear: both" placed i...

Formatting floats in Objective C

I need to format a float (catchy title, he?) to 2 decimal places, but only if those decimal places have values that aren't zero. Example: I have a NSTextField named 'answer', after I do some math with a couple of floats, I want to assign my 'answerFloat' variable to the 'answer' NSTextField. So far I've got: [answer setStringValue:[NSS...

floating stuff within a div, floats outside of div. Why?

This is just a basic question, but I've had this happen to me a couple times and would like to know why. Say you have a div, say you color it green and give it a definite width, when I put stuff within it, in my case an img and another div. The idea is that the content of the container div will cause the container div to stretch out, an...

CSS floating issue

I know this is a srs beginner question, but here goes: I am trying to get a box, with an icon in the top left corner, and all the content of that box will be to the right of the icon. This is the code I am using: <div class="statsbox float_left"> <img src="images/chart_bar.png" class="float_left"> <div class="float_left"> ...

Why is my return value wrong?

Hi all, I have a vector class in C# (a fragment below). My issue is that when I call GetMagnitude(), it always returns 0.0f - even with the debugger running and I check that Sq has a valid value, as soon as it gets passed back into other function (eg: Normalize() ), it has return 0.0f. Can someone explain this and help me fix it? My gue...

Yet another IE image alignment issue: Float right inside right text-align wackiness

I have an <a> element set to display:block, inside of which is some text and a png image. The <a> is set to text-align:right and the image is set to float:right. It's fine in all browsers except IE (8, but haven't tried with earlier versions of IE), which displays the image below the text. If I do the old negative margin trick, it overl...

Python, print all floats to 2 decimal places in output

Have a homework assignment that requires I output 4 different floats to two decimal places. This is what I have: print '%.2f' % var1,'kg =','%.2f' % var2,'lb =','%.2f' % var3,'gal =','%.2f' % var4,'l' Which is very unclean, and looks bad. Is there a way to make any float in that out put '%.2f'? Note: Using Python 2.6. ...

float vs double on graphics hardware

I've been trying to find info on performance of using float vs double on graphics hardware. I've found plenty of info on float vs double on CPUs, but such info is more scarce for GPUs. I code with OpenGL, so if there's any info specific to that API that you feel should be known, let's have at it. I understand that if the program is mov...

Determine which function to call based on length of decimal

In C#, I have a situation where I have two possible numbers in a textbox control. The numbers can be either: a) .xxxx or b) .xx How do I write a condition that says, "If the textbox has 4 decimal places, then call this function, otherwise, if the textbox has 2 decimal places, then call this function." Seems easy, but I don't know h...

iPhone XML parsing float data

I'm reading XML data and creating objects, but I need some of my object variables to be floats. And with the - (void)parser:(NSXMLParser *)parser foundCharacters:(NSString *)string it obviously becomes a string and my float variables will be set to 0.000000. In the - (void)parser:(NSXMLParser *)parser didEndElement:(NSString *)elementN...

CSS: How to make a block to cover all width of parent block

Hi, I've come across the same issue several times already. When I display one block with the float property, the next block starts to overlape the first one. e.g. Following block of code .row_item{ width: 30%; display: block; float: left; padding: 4px; margin-left: 5px; } So if in html I have: <div class="row_item"> <a href="/a...

DIVs after a float left element on explorer appears after that element (not underneath)

Why does the 2 boxes are side by side in IE7 while "b" is underneath "a" on other browsers (where it should be)? <html> <head> <style type="text/css"> .a { float:left; width:100px; height:50px; background-color:#CCC; } .b { width:75px; height:75px; background-color:#F00; } </style> </head> <body> <div class="a">a</div> <div class="...

Find the width of a left floated list and apply to wrapper div to center it using css - jQuery?

Hi, I wish to center a ul in a div that is the left column of a liquid layout. To do so I need to set the width of a div that I've used to wrap the ul. Note: the list items (and content) are retrieved from a database using php. I'm interested in your suggestions on how to do this using jquery. Consider the below markup: <div id="wrap...

Convert float to bigint (aka portable way to get binary exponent & mantissa)

In C++, I have a bigint class that can hold an integer of arbitrary size. I'd like to convert large float or double numbers to bigint. I have a working method, but it's a bit of a hack. I used IEEE 754 number specification to get the binary sign, mantissa and exponent of the input number. Here is the code (Sign is ignored here, that's...

Java Float become 0.0 after adding to ArrayList<T>

I have the following object : class Repeat{ private long startIndex; private long endIndex; private int length; private float repetitions; private float period; private int errors; private float percentOverlap; public void setPercentOverlap(float percentOverlap) { this.percentOverlap = percentOve...

Added Space Below Divs

I have a layout in which the navigation is a set of divs stacked on top of each other. Typical stoy, "It works with every browser ever except the worst ones, IE." I want it to not have any space in between the divs in IE. Here is the URL: http://www.drmsmaggio.com/ I had this problem before when I didn't declare the doctype, but that i...

What is a good way to show a floating point number via SNMP?

I am coding an SNMP Agent. I need to send values that have a decimal point to an SNMP Manager. I have a couple options: Truncate the number. Multiply by a constant. Ask Stackoverflow. If I truncate the number I lose a lot of information that I need. If I multiply by a constant, then the manager will display strange units that the ...