The CSS margin properties define the space around elements.
Questions tagged [margin]
3723 questions
51
votes
14 answers
Align a div to center
I want to float a div to center. Is it possible? text-align: center is not working in IE.

ACP
- 34,682
- 100
- 231
- 371
50
votes
6 answers
jQuery.css() - marginLeft vs. margin-left?
With jQuery.css() I've been told I can use the following two functions for the same results:
$(".element").css("marginLeft") = "200px";
$(".element").css("margin-left") = "200px";
I've always used marginLeft as this is what is used in the…

Curtis
- 101,612
- 66
- 270
- 352
49
votes
4 answers
app:layout_marginBottom is not working well with android constraint layout
Is there any reason why the following layout_marginBottom is not working?
However, if I use layout_marginTop on the second view it does work well

Ron____
- 782
- 1
- 6
- 6
49
votes
5 answers
How do I add a margin to a CSS webkit scrollbar?
I'd like to create a gap between the scrollbar and the right edge of the screen.
How do I achieve this?

user3757637
- 601
- 1
- 6
- 4
49
votes
6 answers
Using margin / padding to space from the rest of the
Ive got a block of text, and i want to write the authors name and date bellow it in small italics, so i put it in a block and styled it, but i want to space the name out a little bit so i applided margin (also tried padding) to the block but…

sam
- 9,486
- 36
- 109
- 160
48
votes
5 answers
Add bigger margin to EditText in Android AlertDialog
I have an EditText inside an AlertDialog. It looks like this.
See where it says tddjdjck and how it is indented quite a lot. That is what I want (I used setPadding with left and right set to 50), but I also want the blue line under it to be…

b85411
- 9,420
- 15
- 65
- 119
46
votes
7 answers
Why doesn't margin get filled with background color in CSS?
I have this simple piece of HTML.
Why doesn't the background color fill the entire #footer element's background - specifically, including the margin?