How can I make the bottom margin of a div equal to its percentage-calculated right margin?



I have an array of floating divs that fit 4 to a row. Their widths and right margins add up to 100%. Their bottom margins, however, are static. CSS below:


.item {
position: relative;
float: left;
height: 200px;
width: 23%;
margin-right: 2%;
margin-bottom: 15px;
background-color: #ddd;
}

Is there a way to retrieve the value of the right margin and apply it to the bottom margin so they are always consistent?


Here is an example of what I have: http://jsfiddle.net/kVZMU/


Related to : How can I make the bottom margin of a div equal to its percentage-calculated right margin?
margin-bottom not appearing in webkit when using jQuery Masonry and percentage values
Programming Languages

Hey I'm using the jquery masonry plugin with the basic settings.


For some reason jquery isn't displaying the margin-bottom i've specified in webkit browsers but is in firefox/gecko.


I've never experienced this before, any ideas?


update - I've realised its tied to the fact that I'm using a percentage to set margin_bottom. Is there a way to get around this


margin-top and margin-bottom inside floated div not working
Programming Languages

I have a problem with margin-top and margin-bottom for some elements inside a floated div.


It's a column div floated to the right (I have also 2 other column divs floated to the left)


Demo here:
http://jsfiddle.net/zTb3g/


I need the "float" to adjust columns in the page, but the margin-top and margin-bottom don't work in some of the elements (ex: b, label, a), yet it works normally for other elements (ex: p, input).


I tried a lot of clearing styles in different places of the markup. Hope someone can help.


Thanks


How can I make the bottom margin of a div equal to its percentage-calculated right margin?
Programming Languages

I have an array of floating divs that fit 4 to a row. Their widths and right margins add up to 100%. Their bottom margins, however, are static. CSS below:


.item {
position: relative;
float: left;
height: 200px;
width: 23%;
margin-right: 2%;
margin-bottom: 15px;
background-color: #ddd;
}

Is there a way to retrieve the value of the right margin and apply it to the bottom margin so they are always consistent?


Here is an example of what I have: http://jsfiddle.net/kVZMU/


How do I make a absolute positioned div have a width equal to it's parent minus some margin
Programming Languages

I want to have an inner div that sites inside different sized container divs, and starts at a fixed left position and then has a width that fills up the rest of the container. I've included some example css below to try to get the point across.


I have to use absolute positioning so can't just float right and set a left-margin. Any ideas of how to make this work with absolute positioning? I've also tried width: auto and some different box-sizing options.


To clarify, the trickiness of this is that the left border has to be fixed, and the left border has to be against the right border of the container. I can't use position: relative, and javascri

What is the rationale behind margin-top: auto and margin-bottom: auto amounting to 0 margin?
Programming Languages

Since margin-right: auto and margin-left: auto center an element horizontally, I would expect their vertical counterparts to behave in the same way.


Yet I understand this does not happen, as per CSS specs:


10.6.2 Inline replaced elements, block-level replaced elements in normal flow, 'inline-block' replaced elements in normal flow and floating replaced elements

If 'margin-top', or 'margin-bottom' are 'auto', their used value is 0.


Also applies to block elements:


10.6.3 Block-level non-replaced elements in normal flow when 'overflow' computes to '
"body""div style="margin: 100px;"""/div""/body" :: IE6 doesn't apply margin bottom?!
Programming Languages

Hi all

Code:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>untitled</title>

</head>
<body style="marg

Privacy Policy - Copyrights Notice - Feedback - Report Violation - RSS 2017 © bighow.org All Rights Reserved .