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


New Jersey
HOME ยป 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 what you see:



However, there is no visual margin depicted when you hover over the element i.e. the margin is 'outside' the border and can be visualized. But negative margins don't show up. How do they look and what is it that makes it different?


Why is margin-top:-8px not the same as margin-bottom:8


Related to : How do negative margins in CSS work and why is (margin-top:-5 != margin-bottom:5)?
How do negative margins in CSS work and why is (margin-top:-5 != margin-bottom:5)?
by New Jersey in 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


Why does margin-top work, but margin-bottom doesn't?
by kema in 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


Weird Margin Issue in All Versions of IE (Including 9) - Negative Margins?
by Matthias in Web Design

http://www.goo.gl/tpL04
You can see the difference here:
http://img534.imageshack.us/img534/8...20813at557.png
Any ideas? A negative margin is being used to pull the image "up" - Im thinking that may have something to do with it? The problem only occurs in IE (of course).
Negative bottom margin not working in IE
by Justin Blanton in Web Design

I have a div that is hidden from view:


position:fixed;
bottom:-240px;

*UPDATE II *


doubling the bottom from bottom:-240px to -480px and then adjusting the animation height has hidden the div in IE9 and eliminated the flickering in Chrome an


Safari Margin Issue - not the negative margin on a floated element bug
by Henschkowski in Web Design

Background info:
- I have validated the page and CSS, no problems there
- Site is working properly in Firefox and IE, seems to be a margin issue in Safari
-This margin issue is not the common Safari bug with a negative margin being applied to a floated element
-I am using Safa


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 Web Design

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!


Safari margin issue - not the float with negative margin bug
by Super56K in Web Design


Background info:
- I have validated the page and CSS, no problems there
- Site is working properly in Firefox and IE, seems to be a margin issue in Safari
-This margin issue is not the common Safari bug with a negative margin being applied to a floated element
-I am us
swf at 100% width/height with a left margin of 400px and a bottom margin of 200px?
by mii in Web Design

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
Height of div under div with negative margin not reaching bottom window edge
by LinnheCreative in Web Design

I suppose the summary pretty much says what my issue is. I would provide a link but this particular page only works if you have login credentials, so I included a screen shot. You can see the location of the footer is way up high but the bottom of it should hug the window. The white content is sp
How can I make the bottom margin of a div equal to its percentage-calculated right margin?
by mckasty in Web Design

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:
HD Wallpapers
3D
3D Abstract
City
Celebrities
Indian Celebrities
Cars
Travel
Girls
Animals Birds
Movies
Sports
Black White
Nature
Planes
Anime
Food Drink
Dreamy Fantasy
Architecture
Games
Space
Holidays
Flowers
Love
Artistic
Baby
Beach
Bikes Motorcycles
Macro
Computers
Vector
Funny
Army
Textures
Brands
Misc
Music
Other
Privacy Policy - Copyrights Notice - Feedback - Report Violation - RSS 2017 © bighow.org All Rights Reserved .