英文:
css contrast color error, i don't know why
问题
以下是您的代码的中文翻译:
这是我的代码
我决定设置背景颜色:#f1f5ff
和文字颜色:#181818;
我认为它的对比度很好,但仍然出现错误
我看不到文字...
问题是什么。。。T.T
我还尝试了将color改为font-color
但结果仍然是相同的错误
我几天前看到了这个错误,但直到现在都无法解决...
请帮助我 T.T
import React from 'react';
import styled, { keyframes } from 'styled-components';
//import CompanyAdvantages from '../Sample/CompanyAdvantages';
export default function SecondArea() {
return (
<Container>
<Row1>
<TextContainer>
<Text1>安全和便捷的购买中介服务</Text1>
<Text2>
通过减少流通边际,连接买家和卖家的C2Mt服务策展者
</Text2>
</TextContainer>
</Row1>
</Container>
);
}
const Container = styled.section`
width: 100vw;
height: 560px;
position: relative;
background-color: #f1f5ff;
color: #181818;
font-size: 12px;
line-height: 20px;
font-family: GmarketSansTTFMedium;
`;
const Row1 = styled.div`
display: flex;
flex-grow: 1;
position: absolute;
top: 35%;
flex-direction: column;
`;
const TextContainer = styled.div`
display: flex;
justify-content: center;
align-items: center;
flex-direction: column;
width: fit-content;
height: fit-content;
line-height: 52px;
font-size: 48px;
opacity: 0;
`;
const Text1 = styled.div`
font-weight: 300;
text-align: left;
`;
const Text2 = styled.div`
font-weight: bold;
text-align: left;
`;
希望这有助于您的工作!如果需要进一步的帮助,请告诉我。
英文:
this is my code
i decided background-color: #f1f5ff
and color(font-color): #181818;
i think it contrast is good but still occured error
i can't see text..
what is problem .. T.T
and also i tried color -> font-color
but result is same error
i see this error few days ago, but i can't solve until now..
please help me T.T
import React from 'react';
import styled, { keyframes } from 'styled-components';
//import CompanyAdvantages from '../Sample/CompanyAdvantages';
export default function SecondArea() {
return (
<Container>
<Row1>
<TextContainer>
<Text1>안전하고 간편한 나의 구매 중개사</Text1>
<Text2>
유통 마진 거품을 줄여 구매자와 판매자를 잇는 C2Mt서비스 비즈큐레이터
</Text2>
</TextContainer>
</Row1>
</Container>
);
}
const Container = styled.section`
width: 100vw;
height: 560px;
position: relative;
background-color: #f1f5ff;
color: #181818;
font-size: 12px;
line-height: 20px;
font-family: GmarketSansTTFMedium;
`;
const Row1 = styled.div`
display: flex;
flex-grow: 1;
position: absolute;
top: 35%;
flex-direction: column;
`;
const TextContainer = styled.div`
display: flex;
justify-content: center;
align-items: center;
flex-direction: column;
width: fit-content;
height: fit-content;
line-height: 52px;
font-size: 48px;
opacity: 0;
`;
const Text1 = styled.div`
font-weight: 300;
text-align: left;
`;
const Text2 = styled.div`
font-weight: bold;
text-align: left;
`;
答案1
得分: 1
在您的TextContainer
样式组件中,您已将opacity: 0
设置为透明度。在父组件上设置不透明度会影响其子组件。移除它,您将能够看到文本。
英文:
In your TextContainer
styled component, you have set opacity: 0
. Setting an opacity on a parent component will affect its child components too. Remove it and you will be able to see the text.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论