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
252
votes
9 answers

Absolute positioning ignoring padding of parent

How do you make an absolute positioned element honor the padding of its parent? I want an inner div to stretch across the width of its parent and to be positioned at the bottom of that parent, basically a footer. But the child has to honor the…
d512
  • 32,267
  • 28
  • 81
  • 107
220
votes
16 answers

Base64 length calculation?

After reading the base64 wiki ... I'm trying to figure out how's the formula working : Given a string with length of n , the base64 length will be Which is : 4*Math.Ceiling(((double)s.Length/3))) I already know that base64 length must be %4==0…
Royi Namir
  • 144,742
  • 138
  • 468
  • 792
212
votes
16 answers

Encrypt and decrypt using PyCrypto AES-256

I'm trying to build two functions using PyCrypto that accept two parameters: the message and the key, and then encrypt/decrypt the message. I found several links on the web to help me out, but each one of them has flaws: This one at codekoala uses…
Cyril N.
  • 38,875
  • 36
  • 142
  • 243
186
votes
5 answers

Why does base64 encoding require padding if the input length is not divisible by 3?

What is the purpose of padding in base64 encoding. The following is the extract from wikipedia: "An additional pad character is allocated which may be used to force the encoded output into an integer multiple of 4 characters (or equivalently when…
Anand Patel
  • 6,031
  • 11
  • 48
  • 67
185
votes
6 answers

Add zero-padding to a string

How do I add "0" padding to a string so that my string length is always 4? Example If input "1", 3 padding is added = 0001 If input "25", 2 padding is added = 0025 If input "301", 1 padding is added = 0301 If input "4501", 0 padding is added = 4501
001
  • 62,807
  • 94
  • 230
  • 350
170
votes
10 answers

Margin/padding in last Child in RecyclerView

I'm trying to add Padding/Margin Bottom in the last row and Padding/Margin Top in the first row. I can not do it in the item xml as it would affect all of my Children. I have headers and children in my RecyclerView Adapter so I can not use the …
RedEagle
  • 2,358
  • 3
  • 13
  • 18
167
votes
15 answers

WPF: Grid with column/row margin/padding?

Is it easily possible to specify a margin and/or padding for rows or columns in a WPF Grid? I could of course add extra columns to space things out, but this seems like a job for padding/margins (it will give much simplier XAML). Has someone derived…
Brad Leach
  • 16,857
  • 17
  • 72
  • 88
156
votes
18 answers

Can we define min-margin and max-margin, max-padding and min-padding in css?

Can we define min-margin and max-margin, max-padding and min-padding in CSS ?
omkar
  • 1,778
  • 3
  • 13
  • 15
149
votes
7 answers

Why does CSS not support negative padding?

I have seen this many a times that the prospect of a negative padding might help the development of CSS of certain page elements become better and easier. Yet, there is no provision for a negative padding in the W3C CSS. What is the reason behind…
ikartik90
  • 2,695
  • 6
  • 26
  • 38
148
votes
9 answers

Padding within inputs breaks width 100%

Ok, so we know that setting padding to an object causes its width to change even if it is set explicitly. While one can argue the logic behind this, it causes some problems with some elements. For most cases, you just add a child element and add…
Sandman
  • 2,323
  • 5
  • 28
  • 34
145
votes
2 answers

How to add a simple 8dp header/footer to Android's RecyclerView?

Is there a way to add a simple header/footer to a RecyclerView? Here you can see what I've got. The first Card touches the Toolbar And here you can see what I would like to achieve: 8dp Padding between the bottom and the Card. Methods I tried…
Philipp Schumann
  • 1,790
  • 2
  • 12
  • 12
126
votes
7 answers

Padding a table row

Table Row Padding Issue
Spencer
  • 4,018
  • 10
  • 33
  • 43
121
votes
8 answers

jQuery How to Get Element's Margin and Padding?

Just wondering - how using jQuery - I can get an elements formatted total padding and margin etc ? i.e. 30px 30px 30px 30px or 30px 5px 15px 30px etc I tried var margT = jQuery('img').css('margin'); var bordT = jQuery('img').css('border'); var…
Tom
  • 1,229
  • 2
  • 8
  • 5
115
votes
3 answers

Adding padding to a tkinter widget only on one side

How can I add padding to a tkinter window, without tkinter centering the widget? I tried: self.canvas_l = Label(self.master, text="choose a color:", font="helvetica 12") self.canvas_l.grid(row=9, column=1, sticky=S, ipady=30) and self.canvas_l =…
Jack S.
  • 2,501
  • 6
  • 25
  • 27
113
votes
9 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,986
  • 5
  • 28
  • 35