Questions tagged [padding]

Extra space inserted into memory structures to achieve address alignment -or- extra space between the frame and the content of an HTML element -or- extra spaces or zeros when printing out values using formatting print commands like, in C, the printf*-family of functions.

Padding in memory structures is the insertion of additional bytes of unused space to make the internal fields of a structure align to desirable address boundaries.

Padding in HTML layout is extra space inserted between the content of the element and its border or frame. Padding is space added to the interior of the element; margin is space around the exterior of the element.

In arrays, padding is addition of extra 0's (zeros) in one or more dimension of the array in a symmetric, circular or replicating manner. This is important for signal and image processing, in the context of and convolution.

3939 questions
73
votes
13 answers

-webkit-margin adds unwanted margin on texts

This hadn't hit me until now (and this is not only in webkit browsers). On all texts in like p tags, h1 tags etc... there's an extra space over and below the text. In chrome I found this: user agent stylesheet -webkit-margin-before:…
tbleckert
  • 3,763
  • 4
  • 32
  • 39
73
votes
11 answers

How to achieve UIButton / UILabel 'padding' in iPhone app

I've got various views in my iPhone application that require padding e.g a custom UIButton with text aligned left, and a UILabel with a background color. This may be a really stupid question, but how can I apply 'padding' to move the text off the…
user210437
73
votes
7 answers

How to add padding-left on a UIButton created programmatically?

I am having a trouble adding left padding on a UIButton. I have a UIButton with UIControlContentHorizontalAlignmentLeft. I want the text to be displayed on the left side but it is too left. when I give the border, it doesn't look good. I would like…
MissStack
  • 833
  • 1
  • 6
  • 6
72
votes
3 answers

std::tuple sizeof, is it a missed optimization?

I've checked all major compilers, and sizeof(std::tuple) is 16 for all of them. Presumably they just put elements in order into the tuple, so some space is wasted because of alignment. If tuple stored elements internally like:…
geza
  • 28,403
  • 6
  • 61
  • 135
72
votes
13 answers

Flutter - how to remove default padding (48 px as per doc) from widgets (IconButton, CheckBox, FlatButton)

I am facing a problem with the default padding of the widgets (IconButton, CheckBox, FlatButton). I have searched a lot for this concern but with no success. In the above image, the outer blue rect is the actual size of these widgets and I have to…
Rahul Sharma
  • 12,515
  • 6
  • 21
  • 30
72
votes
12 answers

How do you specify table padding in CSS? ( table, not cell padding )

I have a table with a colored background and I need to specify the padding between the table and it's content, I.E. cells. The table tag doesn't seem to accept a padding value. Firebug shows the table and tbody's layout with padding 0 but doesn't…
Petruza
  • 11,744
  • 25
  • 84
  • 136
71
votes
5 answers

setBackgroundResource() discards my XML layout attributes

I have a view which is used as an item in a ListView. In my custom adapter, I change the background of the view using View.setBackgroundResource() depending on the item's position in the list. (I have separate assets for the first and last items in…
Graham Borland
  • 60,055
  • 21
  • 138
  • 179
68
votes
7 answers

How to increase the distance between table columns in HTML?

Let's say I wanted to create a single-rowed table with 50 pixels in between each column, but 10 pixels padding on top and the bottom. How would I do this in HTML/CSS?
idude
  • 4,654
  • 8
  • 35
  • 49
66
votes
14 answers

How to remove the top and bottom space on textview of Android

When I include the below XML to layout file, I can see the below image. If you see it, you could realize that the TextView has top and bottom space.…
mooongcle
  • 3,987
  • 5
  • 33
  • 42
65
votes
4 answers

Android TextView drawable, change padding between drawable and text?

I am creating a TextView with a drawable underneath, in a GridLayout. I want to bring the drawable to the middle of the TextView; I tried with setCompoundDrawablePadding(-75) and it only changes the position of the text. Current code: TextView…
user1648374
  • 655
  • 1
  • 5
  • 8
64
votes
8 answers

Add "padding" to a UITextView

as the title says i am trying to add padding-like behavior to a UITextView. The textview is generated when the view is pushed inside my navigation controller and the following code occurs: self.textView.layer.cornerRadius = 7; //pretty stuff is…
magtak
  • 986
  • 1
  • 9
  • 20
60
votes
4 answers

Pad left or right with string.format (not padleft or padright) with arbitrary string

Can I use String.Format() to pad a certain string with arbitrary characters? Console.WriteLine("->{0,18}<-", "hello"); Console.WriteLine("->{0,-18}<-", "hello"); returns -> hello<- ->hello <- I now want the spaces to be…
Boris Callens
  • 90,659
  • 85
  • 207
  • 305
60
votes
4 answers

Padding not working on ImageButton

In an app I am working on, I have several ImageButtons. Each ImageButton has a background and content in the form of a drawable. Right now the drawable is at maximum size within the confines of the ImageButton, but I want it to scale down so I need…
Zero
  • 1,864
  • 3
  • 21
  • 39
56
votes
8 answers

Angular2 or TypeScript: Left padding a String with Zeros

I have a number, let's say 9. But I need it as the string "09". I know I can write my own logic. But I am looking for an implicit utility function which can pad the number. I am using Angular2 with TypeScript. Looking for something like this. Just…
Partha Sarathi Ghosh
  • 10,936
  • 20
  • 59
  • 84
55
votes
3 answers

CSS Div width percentage and padding without breaking layout

There may be a simple fix for this, but it has troubled me for ages now... Let me explain the situation. I have a div with the ID 'container' that holds all the contents in the page (including header and footer also) that will keep everything…
Kyle Ross
  • 2,090
  • 4
  • 20
  • 27