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.

3517 questions
82
votes
10 answers

String Padding in C

I wrote this function that's supposed to do StringPadRight("Hello", 10, "0") -> "Hello00000". char *StringPadRight(char *string, int padded_len, char *pad) { int len = (int) strlen(string); if (len >= padded_len) { return string; …
jackson
82
votes
6 answers

Decorating Hex function to pad zeros

I wrote this simple function: def padded_hex(i, l): given_int = i given_len = l hex_result = hex(given_int)[2:] # remove '0x' from beginning of str num_hex_chars = len(hex_result) extra_zeros = '0' * (given_len - num_hex_chars)…
jon
  • 5,300
  • 4
  • 24
  • 34
79
votes
5 answers

Style the first column of a table differently

If I have a table with two columns, how do I specify a padding or any other css so that it is applied just for the first column of s. Also how do I style an n-th column similarly?
Shalin
  • 1,111
  • 3
  • 10
  • 17
77
votes
2 answers

How to get an element's padding value using JavaScript?

I have a textarea in my HTML. I need to get the padding numerical value in pixels as either integer or float. How can I get it using JavaScript? I am not using jQuery, so I'm looking for pure JavaScript solutions.
R. Dewi
  • 3,691
  • 8
  • 39
  • 65
77
votes
7 answers

Remove all padding and margin table HTML and CSS

I have this table :
1 2
and…
begiPass
  • 1,904
  • 6
  • 33
  • 56
76
votes
3 answers

Padding-bottom/top in flexbox layout

I have a flexbox layout containing two items. One of them uses padding-bottom : #flexBox { border: 1px solid red; width: 50%; margin: 0 auto; padding: 1em; display: flex; flex-direction: column; } #text { border: 1px solid…
Simon_Weaver
  • 120,240
  • 73
  • 577
  • 618
74
votes
5 answers

Padding on StackPanel?

I am trying to set padding of a StackPanel but there ain't such property. I tried StackPanel.Border, but there is no such property either. Any ideas?
Shimmy Weitzhandler
  • 92,920
  • 119
  • 388
  • 596
73
votes
4 answers

How to set the padding for CardView widget in Android L

I'm using android:paddingLeft and android:paddingTop to set the padding for the new CardView widget but it doesn't work. I can set the margin for all the controls inside the CardView as a workaround but that's a pain if there are too many controls.…
nomongo
  • 3,315
  • 7
  • 28
  • 33
72
votes
12 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,632
  • 4
  • 30
  • 38
72
votes
10 answers

UIButton Text Margin / Padding

I have the following layout, and I'm trying to add a padding to the left and right.. The controls are a disabled UIButton. My code for creating a button is this: UIButton *buttonTime = [[UIButton alloc] initWithFrame:CGRectMake(90, 10, 50, 20)];…
PartySoft
  • 2,539
  • 7
  • 36
  • 55
72
votes
8 answers

CSS: Background image and padding

I want to add a background image on the right side of the list items, and want to have some padding from the right side as well, but I'm unable to do that. Please have a look at following example: HTML:
  • Hello
  • Hello…
user966582
  • 2,717
  • 4
  • 28
  • 32
71
votes
10 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
70
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
  • 57,578
  • 20
  • 131
  • 176
70
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
  • 26,117
  • 6
  • 47
  • 111
70
votes
6 answers

IOS - remove ALL padding from UITextView

There are many great examples on SO to remove the left padding of a UITextView. How to lose margin/padding in UITextView? However, I need to remove the right padding too. I have tried... [tv setContentInset: UIEdgeInsetsMake(-4,-8,-8,-X)];//where X…
mattyd
  • 1,393
  • 2
  • 14
  • 25