margin

When to use margin vs padding in CSS

When writing CSS, is there a particular rule or guideline that should be used in deciding when to use margin and when to use padding? ...

CSS - Help me style this menu without using margins?

Hi, I'm creating a site where I've encountered a huge IE lag when hovering over the menus. I'm using Cufon in combination and it seems like it's causing a huge lag when I apply height, width, margins or paddings to the li:hover element. So, I need to figure out a smart way of doing this otherwise. The site is here, http://w3box.com/m...

Issue with margins when markup is added with jQuery?

For some reason, if I add these buttons with jQuery (because of an Ajax insert function) they look strange to when they are loaded via PHP on the server? What is the reason for this behavior Here is the jQuery that inserts it: var actions = '<td><a href="#" class="small awesome black editButton" id="'+id+'">Edit</a><a href="/appoint...

jQuery, toggling div, CSS spacing issue

I have this markup: <div class="myToggledDiv"> <div>content</div> </div> <div style="margin-top: 10px;"> content </div> Via jQuery, I'm doing a .slideToggle to show/hide the top div. I'd like there to be the 10px space between the two divs at all times, whether collapsed or expanded. The behavior, however is that as the to...

css/html: vertical div-alignment-Problem (added live-demo)

Hi! I have a problem with aligning some divs in this case: <div id="preamble" style="margin-bottom: 100px;">Preamble</div> <div id="container" style="position: relative;"> <div id="content" style="position: relative; margin-top: 50px;"> Content </div> </div> (Of course this is only an example that reproduces the behav...

Centring fixed width DIV inside 100% width parent DIV

I have a setup similar to below: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"&gt; <html xmlns="http://www.w3.org/1999/xhtml”&gt; <div id=“a” style=“width: 100%”> <div id=“b” style=“width: 200px; margin: 0 auto”> </div> </div> And this centres fine in everything except IE...

Why is ie7 ignoring the left-margin on my first list item (only)??

http://blog.helpcurenow.org/test/mockups/mar2010/lp.html In the above landing page, I have an offers box that has four donation buttons. The first three are targeted with individual id's and given a left margin of 13px. All is well in every browser I'm viewing in except ie7. For some reason ie7 is ignoring the left-margin of 13px on th...

Making an half-disappeared element in CSS visible...

I've been trying many techniques.. but none helped. I tried "margin-bottom: 1em", "bottom: 2em", etc. but the element stays nearly invisible. See the bottom of the page.. there is a sentence, which is used to be shown.. Here's the URI: http://Sulayman.org/ Can anyone help me? - Thanks! ...

How to center an R plot after removing axis labels

I'm working on visualizing a matrix in R (almost exactly like http://reference.wolfram.com/mathematica/ref/MatrixPlot.html), and I've been using image(<matrix>,axes=FALSE) to draw the picture. However, I noticed that with the y-axis turned off, the plot isn't centered--the space is still there for the axis ticks + label. I can finag...

Set margins in a LinearLayout programmatically.

I'm trying to use Java (not XML) to create a LinearLayout with buttons that fill the screen, and have margins. Here is code that works without margins: LinearLayout buttonsView = new LinearLayout(this); buttonsView.setOrientation(LinearLayout.VERTICAL); for (int r = 0; r < 6; ++r) { Button btn = new Button(this); btn.setTe...

Unknown margin being added to a footer in IE6 + 7

So yeah, like I said, I've spent a few hours trying to fix this bug in the footer that add's an extra 20-30px on to the bottom of the page in IE6 and 7. I've currently set all bottom margins to 0 so as to find what's causing it, I then scoured ie developer tools but came up empty. Here's the homepage design hosted on my web design play...

2 vertically positioned divs, what could prevent them from "touching?"

Click here to see what I mean.. What could prevent these two from sitting directly atop each other like that. At the moment on my site I have to use margin-bottom:-22px; to get the effect. And of course, it doesn't work in IE... Thanks :) ...

Div on top of Div using z-index.

I have the following divs in my HTML: <div class="main"> <div class="bgimage"></div> <div class="content">Text</div> which is directly inside my body. With the following CSS: body{margin:0;padding:20px 0;} .content{filter:alpha(opacity=50);-moz-opacity: 0.5;opacity: 0.5;} .content{position:relative;z-index:1;border:#000 thin soli...

CSS: Chrome and Safari seem to 'add' border to width, while IE, Firefox & Opera don't

Hey guys, I'm trying to achieve cross-browser consistency for my website, but I have been trying all day now and its driving me nuts (0.38 am here in Europe now..). It's about this page: http://www[insert-dot-here]geld[insert-dash-here]surfen[insert-dot-here]nl/uitbetalingen.html (please note that I prefer this URL not to be made crawlab...

How do I increase the spacing of the line number margin in vim?

I have a problem with my colorscheme in vim: The line numbers are too close to the code. How I can increase the width of the line numbers' right margin? ...

Simple CSS height problem

Hello! I am trying to just create a basic layout, but i am having trouble to get it to auto-adjust the height. Something is wrong with the DIV-container since it's not adding the padding correctly to the top and bottom elements. It should be the size of the highest block, right now its the menu block. Any ideas? Website ...

Body Margin:0, Div Width:100% problem in FF and Chrome, fine in IE

Hey People, I'm starting to pull my hair out of my head... I have the following: <html> <head> <style> body { margin:0 auto; } </style> </head> <body> <div style="border: solid 1px red; width: 100%;">test</div> </body> </html> This works in IE producing a nice div, 100% width, no H scrollbar... Now in Chrome and FF, it is 1...

Floated element not included in parent, causing margin-bottom problems

Right, so I've got a section of a page: <div class="article"> <div class="author"> <img src="images/officers/john_q_public_thm.jpg" /> <span class="name">John Q. Public</span> <span class="position">President</span> </div> <abbr class="postdate"> <span class="month m-01">Jan</span> <sp...

How do I get hold of the margins of the Paper when using java printing?

I'm trying to print a JPanel with some painted graphics on it (overriding paintComponent). The graphics is so big that they wont fit on a single page and therefor I'm letting it span across multiple pages. My problem lies within the fact that if I let the user choose the pageFormat/Paper type by calling: PrintRequestAttributeSet aset =...

Silverlight and data bound property animation (Margin)

Hello! I have Border element with Margin property bound to StartDate (DateTime) property of some class. If property changed margin is changed also (with a help of converter). I'd like to make changes as smoothly as possible. for example, on UI side one hour in data class equals to 15 pixels on screen and when i change StartDate +/- o...