Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
192 views
in Technique[技术] by (71.8m points)

reactjs - How can I use different properties for the same component using Styled Component for React JS?

For example for same component at some places I want to use border while at other places border-bottom

How can I achieve this?

Also can anyone please tell me what this code in styled component means:

color: ${prop('theme.color.blue', '#0F0F3A')};
question from:https://stackoverflow.com/questions/65862310/how-can-i-use-different-properties-for-the-same-component-using-styled-component

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Each properties can take 4 values. Set width to 0 if you don't want the border.

div {
 padding: 20px;
 border-style: solid dashed dotted solid;
 border-width: 10px 20px 30px 40px;
 border-color: blue yellow green red;
}
<div> I AM A DIV</div>

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...