Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums CSS Padding in percentages – for fixed element Reply To: Padding in percentages – for fixed element

#190688
Senff
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).