简体   繁体   中英

Aphrodite CSS overwriting margin and padding

I'm having an issue with aphrodite, where if I have my base-component set to the global selector for example margin: 0 or any of the sides marginLeft , marginRight , marginTop , marginBottom set. Then when I try to overwrite one or the other, it doesn't take.

For instance a div set with margin: 0 then I add another style marginBottom: 10 doesn't work. Same is true in reverse. If marginBottom: 10 is set and I set margin: 0 it doesn't work.

https://github.com/Khan/aphrodite

From the docs: Object Key Ordering

const styles = StyleSheet.create({
ordered: new Map([
    ["margin", 0],
    ["marginLeft", 15],
  ]),
});

Note that Maps are not fully supported in all browsers. It can be polyfilled by using a package like es6-shim .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM