CSS对比色错误,我不知道为什么。

huangapple go评论52阅读模式
英文:

css contrast color error, i don't know why

问题

以下是您的代码的中文翻译:

这是我的代码
我决定设置背景颜色:#f1f5ff
和文字颜色:#181818;

我认为它的对比度很好,但仍然出现错误

我看不到文字...

问题是什么。。。T.T

我还尝试了将color改为font-color

但结果仍然是相同的错误

我几天前看到了这个错误,但直到现在都无法解决...

请帮助我 T.T

CSS对比色错误,我不知道为什么。

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

CSS对比色错误,我不知道为什么。

import React from &#39;react&#39;;
import styled, { keyframes } from &#39;styled-components&#39;;
//import CompanyAdvantages from &#39;../Sample/CompanyAdvantages&#39;;

export default function SecondArea() {
  return (
    &lt;Container&gt;
      &lt;Row1&gt;
        &lt;TextContainer&gt;
          &lt;Text1&gt;안전하고 간편한 나의 구매 중개사&lt;/Text1&gt;
          &lt;Text2&gt;
            유통 마진 거품을 줄여 구매자와 판매자를 잇는 C2Mt서비스 비즈큐레이터
          &lt;/Text2&gt;
        &lt;/TextContainer&gt;
      &lt;/Row1&gt;
    &lt;/Container&gt;
  );
}

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.

huangapple
  • 本文由 发表于 2023年5月11日 16:14:17
  • 转载请务必保留本文链接:https://go.coder-hub.com/76225466.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定