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/


View Replies

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


swf at 100% width/height with a left margin of 400px and a bottom margin of 200px?
Category : Webmasters
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

View Replies


How do negative margins in CSS work and why is (margin-top:-5 != margin-bottom:5)?
Category : Web Design

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


View Replies


Will the Screen fit to all devices if i use margin top's and margin bottom's in XML in Android
Category : Android

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


View Replies


margin-top and margin-bottom inside floated div not working
Category : Web Design

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


View Replies


margin-bottom not appearing in webkit when using jQuery Masonry and percentage values
Category : Software

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


View Replies


What is the rationale behind margin-top: auto and margin-bottom: auto amounting to 0 margin?
Category : Web Design

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

View Replies


On paragraphs, should I define bottom margin only or top margin also? ::.
Category : Development
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!

View Replies


On paragraphs, should I define bottom margin only or top margin also?
Category : Web Design

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!

View Replies


Space below form (have tried margin:0 and bottom-margin:0)
Category : Web Design

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:

Code:

View Replies


Why does margin-top work, but margin-bottom doesn't?
Category : Web Design

I have the following HTML markup and I want the menu div tag to always be 5px away from the bottom border of the parent container.


I can manually through trial and error position it using margin-top, but if I were to change the logo or modify the div size I'd have to change this value


View Replies


2012 / 2017 Copyrights BigHow , All Rights Reserved .