Doubt with CSS (Doubt about css)

Asked

Viewed 38 times

0

Background

Hello!

How can I build this background in a section using css? I’m a novice and started a personal project, but I can’t build that background with pure CSS. Is it possible to do this? I searched some sites, but they didn’t solve my question.

Hello!

How can I build this background in a Section using css? I’m a Newbie and Started a personal project, but I can’t build this background with Pure css. Was it possible to do it? I searched some sites, but they didn’t Solve my Doubt. i used a div with className={Style.background} and Applied a pseudo-element.:

.background {
  position: relative;
  width: 100%;
  height: 100vh;
  background: #031f73;
  display: flex;
}

 .background::before {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 31.25rem;
  background: #fff;
  clip-path: polygon(100% 0, 10% 100%, 100% 100%);
}
  • Cara has many ways to do it, post what you have tried and we can help you by telling you where you went wrong. Doing it for you would not solve your problem

  • 1

    Well, I put in what I did @hugocsl

1 answer

0


Cara doesn’t need pseudo-element, diagonal cut need not clip-path, to solve the two situations you can use two linear-gradiente diagonally, one to make the blue and one to make the line.

html,
body {
  padding: 0;
  margin: 0;
}
.background {
  position: relative;
  width: 100%;
  height: 100vh;
  background-image: 
    linear-gradient(60deg, transparent 50%, #fff 50%, #fff calc(50% + 4px), transparent calc(50% + 4px), transparent),
    linear-gradient(to bottom right, navy 0%, navy 50%, transparent 50.1%);
  background-size: 110% 110%;
}
<div class="background"></div>

  • 1

    It really worked here... Now this white line, could I position it relative to a distance (like a margin-left) that I wanted? But from now on, thank you Ugo, it helped a lot that you said.

  • @Yandamasceno could yes, you can adjust the % inside the gradient, or if you find it easier then yes use a pseudo-element... If you think the answer solved the problem remember to mark it as accepted in this icon below arrows to answer Lada!

Browser other questions tagged

You are not signed in. Login or sign up in order to post.