Home › Forums › CSS › Padding in percentages – for fixed element › Reply To: Padding in percentages – for fixed element
December 12, 2014 at 1:26 pm
#190688
Participant
@GSutherland: here’s the application of it.
I have a plugin that creates a clone of an element, with all the same classes and IDs (so that it will have the same styles and look & feel), with the only difference that it has position:fixed
.
That works fine if the original element has padding in pixels — the clone will have the same padding. But if the padding is in percentages, then the padding of the original will be a percentage of it’s parents’ width, whereas the padding of the clone will be a percentage of the body width (because of the fixed positioning of the clone).