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


mckasty
HOME ยป 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/


Related to : How can I make the bottom margin of a div equal to its percentage-calculated right margin?
How can I make the bottom margin of a div equal to its percentage-calculated right margin?
by mckasty in 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:
white space appears top/bottom when I use h1 or div with margin-top or margin-bottom
7/1/2015 11:10 am by amenx in Programming Languages

Could you please tell me why space appears when I put inside a div, another div/id/class/heading with margin top or bottom?

Here is the situation

Thank you!


swf at 100% width/height with a left margin of 400px and a bottom margin of 200px?
by mii in Programming Languages
Please can someone tell me if it is possible to have a swf at 100% width/height with a left margin of 400px and a bottom margin of 200px? Have managed the left margin using:
<div style="height:100%;margin-left:400px;"> <div id="flashcontent"></div> </div
margin-bottom not appearing in webkit when using jQuery Masonry and percentage values
by Jon Riegel in 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


margin-top and margin-bottom inside floated div not working
by Bernhard in 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 colum


Will the Screen fit to all devices if i use margin top's and margin bottom's in XML in Android
by evident in Programming Languages

I am developing an application in which i need to use lot of text-views and i am using a relative layout.Since i positioned my text-views in different coordinates(margintop=20dp),will the layout fit for all the android devices(tabs,Nook color phones,normal devices etc)


Any suggestions


How do negative margins in CSS work and why is (margin-top:-5 != margin-bottom:5)?
by New Jersey in Programming Languages

A common trick for vertical positioning elements is to use the following CSS:


.item {
position:absolute;
top:50%;
margin-top:-8px; /* half of height */
height: 16px;
}

When seen in the metric view as in Chrome this is wh


What is the rationale behind margin-top: auto and margin-bottom: auto amounting to 0 margin?
by Bateluer in 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-lev
On paragraphs, should I define bottom margin only or top margin also? ::.
by Scott Walsh in Programming Languages
Hi!
Should I do this?
p
{
margin-top: 2em;
margin-bottom: 2em;
}
or this:
p
{
margin-bottom: 2em;
}
Same question for headers (h1, h2, etc)
Thanks!
Space below form (have tried margin:0 and bottom-margin:0)
by TheStu in Programming Languages

Heya guys,
Hope someone can help me with this one. Been looking around the web but most are suggesting to do what i have already done.
I've got this in style.css file:
Privacy Policy - Copyrights Notice - Feedback - Report Violation - RSS 2014 © bighow.org All Rights Reserved .