PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Monday, October 31, 2022

[FIXED] How can I achieve this kind of box-styling in CSS

 October 31, 2022     border-radius, css, header, html     No comments   

Issue

I just came across a website where almost all the div were styled that way, and I would be interested to know how it is done.

enter image description here


Solution

You can easily get the orange shape by using the clip-path property. I used a Generator to make this shape.

p {
            margin: 0;
        }

        body {
            display: flex;
            justify-content: center;
            align-items: center;
            height: 100vh;
        }

        .card {
            width: 300px;
            background-color: #1D1D1D;
            border-radius: 20px;
            display: flex;
            flex-direction: column;
            justify-content: center;
            align-items: center;
        }

        .heading {
            font-size: 18px;
            text-transform: uppercase;
            color: white;

        }

        .orange {
            display: flex;
            flex-direction: column;
            justify-content: center;
            align-items: center;
            border-radius: 20px;
            width: 100%;
            height: 100px;
            margin-top: 0;
            background-color: #FB961B;
            clip-path: polygon(0 0, 100% 0, 100% 50%, 60% 100%, 40% 100%, 0% 50%);
        }

        .container {
            margin: 10px 20px;
            display: flex;
            flex-direction: column;
            justify-content: center;
            align-items: center;
        }
        p{
            color: white;
        }
        #heading{
            font-size: 18px;
            text-transform: uppercase;
        }

        .para{
            margin-bottom: 20px;
        }
<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <div class="card">
        <div class="orange">
            <p class="heading">starter</p>
            <p class="para">weekly 100% for 4 times</p>
        </div>
        <div class="container">
            <p id="heading">weekly return</p>
            <p>Lorem ipsum... </p>
        </div>
    </div>
</body>

</html>



Answered By - Lemirq
Answer Checked By - Candace Johnson (PHPFixing Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing