The border-radius style will not be effective on the top part of the div

I'm currently developing a landing page for my personal use, but I've encountered an issue. There is a div with a border-radius named .popOut. The border-radius is applied to the bottom of the div but not the header part. Why is this happening? How can I rectify this issue? Additionally, I'm looking to make the box-shadow lighter and less dark. Any suggestions on how to achieve this would be greatly appreciated. Thank you!

Code:

HTML:

    *{margin:0; padding:0;}
    body{
    background: #CCC;
    color:#000305;
    font-size: 87.5%;
    font-family: Arial, 'Lucida Sans Unicode';
    line-height: 1.5;
    text-align: left;
    }
    .body{
    margin: 0 auto;
    width: 70%;
    background:#ebebeb;
    margin:auto;
    }
    .mainBack{
    margin:auto;
    background:white;
    width:600px;
    height:650px;
    }
    .popOut{
    background:white;
    width:80%;
    height:600px;
    margin:auto;
    box-shadow:0px 0px 15px 0px;
    border-radius:6px;
    position:relative;
    top:30px;
    }
    .mainHeader{
    background:linear-gradient(#465BF6,#3149F2);
    width:100%;
    height:100px;
    }
<html>
    <head>
    <meta charset="UTF-8">
    <title>
    Welcome!
    </title>
    <script type="text/javascript" src="jquery.js">
    </script>
    <script type="text/javascript" src="script.js">
    </script>
    <link rel="stylesheet" href="style.css" type="text/css">
    </head>
    <body class="body">
    <div class="mainBack">
    <div class="popOut">
    <div class="mainHeader"></div>
    <div class="mainArea"></div>
    <div class="mainAreaB"></div>
    <div class="mainFooter"></div>
    </div>
    </div>
    </body>
    </html>

Answer №1

Your .headingSection element is overlapping the border-radius of the .expandBox element. To fix this, you can include the following line in your .headingSection class: border-radius: 6px 6px 0px 0px;

Additionally, to make your box-shadow appear lighter, you can specify a color like this:

box-shadow:#777 0px 0px 15px 0px;

Below is an illustrative example:

*{margin:0; padding:0;}
body{
background: #CCC;
color:#000305;
font-size: 87.5%;
font-family: Arial, 'Lucida Sans Unicode';
line-height: 1.5;
text-align: left;
}
.body{
margin: 0 auto;
width: 70%;
background:#ebebeb;
margin:auto;
}
.mainContainer{
margin:auto;
background:white;
width:600px;
height:650px;
}
.expandBox{
background:white;
width:80%;
height:600px;
margin:auto;
box-shadow:#777 0px 0px 15px 0px;
border-radius:6px;
position:relative;
top:30px;
}
.headingSection{
background:linear-gradient(#465BF6,#3149F2);
width:100%;
height:100px;
border-radius: 6px 6px 0px 0px; 
}
<html>
<head>
<meta charset="UTF-8">
<title>
Welcome!
</title>
<script type="text/javascript" src="jquery.js">
</script>
<script type="text/javascript" src="script.js">
</script>
<link rel="stylesheet" href="style.css" type="text/css">
</head>
<body class="body">
<div class="mainContainer">
<div class="expandBox">
<div class="headingSection"></div>
<div class="mainContent"></div>
<div class="sidebar"></div>
<div class="footer"></div>
</div>
</div>
</body>
</html>

Answer №2

To easily fix the issue, just include overflow: hidden; in the .popOut class

Problem solved!

The problem arose because the blue div was overlapping the popOut div, concealing the rounded corners. By adding overflow:hidden;, you can hide any content that spills out of the popOut container!

If you're interested in box-shadow effects, check out this link:

Even seasoned designers find this resource beneficial. The ability to use rgba in box shadow, demonstrated in the link, allows you to adjust color and transparency!

Answer №3

The issue you're experiencing is due to the fact that the element with the class .mainHeader doesn't have a border-radius property set, causing it to overflow beyond the boundaries of the .popOut element.
One way to resolve this is by adding a border-radius to the main header:

.mainHeader{
        background:linear-gradient(#465BF6,#3149F2);
        width:100%;
        height:100px;
        border-radius:5px 5px 0 0;
    }

Check out the JSFiddle Demo
Alternatively, you can set the overflow property of the .popOut element to hidden:

.popOut{
        background:white;
        width:80%;
        height:600px;
        margin:auto;
        box-shadow:0px 0px 15px 0px;
        border-radius:6px;
        position:relative;
        top:30px;
        overflow:hidden;
    }

Take a look at the JSFiddle Demo

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Expanding the size of select dropdown in Material UI to accommodate more options

Is there a way to increase the width of the drop down to 400px? I tried adding inline styles, but it didn't work. Upon debugging, I realized that the width is being overridden by this class. I'm not sure how to overwrite it. Could you please prov ...

Optimizing Image Size According to the Container, Not the Screen Size: A Guide

After exploring various resources on responsive images, I have come across a challenge that has me stumped. It seems like it should be simple, but I can't quite figure it out: How can I serve the appropriate image size based on container width rather ...

When an element is dragged within the mcustomscrollbar container, the scroll does not automatically move downward

I am facing an issue where I have multiple draggable elements inside a Scrollbar using the mcustomscrollbar plugin. When I try to drag one of these elements to a droppable area located below the visible area of the scroller, the scroll does not automatical ...

Tips for creating a div that covers the entire screen and prevents it from resizing

I am facing an issue with a container having the className "container". When I set the height to 100vh like this: .container{ height:100vh } Whenever I resize my screen, such as with dev-tools, the div also shrinks. How can I prevent this? Is it possi ...

Enter a keyword in the search bar to find what you're looking

I am working on a form where users can select their occupation from a list that is stored in a separate .js file. The list includes various occupations like 'AA Patrolman' and 'Abattoir Inspector'. var occupationSelect = "<select id ...

Expanded MUI collapsible table squeezed into a single cell

I'm experimenting with using the MUI table along with Collapse to expand and collapse rows. However, I've noticed that when utilizing collapse, the expanded rows get squished into one cell. How can I adjust the alignment of the cells within the p ...

Is it possible to print a document without it ever showing on the screen

I am developing a feature on my page that allows users to print. The challenge I am facing is that when the user clicks print, I want to generate a new page in the background called "Printable.aspx" and only display the print dialog for it without disrupti ...

Revealing a concealed element by sliding it upwards on a single page, then repeating the

Can someone assist me in achieving a specific effect on my website? I have a top banner section with a button at the bottom. When the button is clicked, a form should slide up into view. The form will initially be hidden. I also need the same effect at the ...

What is the best way to incorporate Blade code into a React component within a Blade view file?

Recently, I've been working on a Laravel view named homepage.blade.php, which includes the following code: <body> <div id=root></div> <script src="./js/app.js"></script> </body> In the app.js file: ...

The CSS styles are not applied when using self.render("example.html") in Tornado/Python

I'm still learning Python and programming in general. I'm currently using Tornado as my web server to host my websites. However, when I try to generate a dynamic html page using self.render("example.html", variables here), the resulting page does ...

Is there a way to customize this JQuery and HTML code to be specific to each row?

https://i.sstatic.net/RwuMl.pngIn CB UserList, each row in the form appears multiple times representing different records. The below code is intended to display a submit button and modules for show/hide functionality separately for each record on the list. ...

Exploring nodes with the help of Cheerio JS

In my HTML code, I am using the Snekfetch library to fetch data. Here is a snippet of the code: <div class="entry-content"> <h4>today's date etc etc</h4> <h3>category name 1</h3> <p> <img class=" ...

Creating a visually appealing chart similar to Excel can be achieved using JavaScript with a whopping 64382 lines of JSON data. No need for Chart.js or any additional tools - simply rely on JavaScript, HTML, and CSS to

I have a project that is due in just a few hours and I need to create a detailed chart using a large set of 64382 lines of JSON data. My knowledge of javascript is limited, so I am struggling to come up with ideas on how to approach this task. While I have ...

What is the best way to implement custom sorting for API response data in a mat-table?

I have been experimenting with implementing custom sorting in a mat-table using API response data. Unfortunately, I have not been able to achieve the desired result. Take a look at my Stackblitz Demo https://i.sstatic.net/UzK3p.png I attempted to implem ...

How to turn off span text in AngularJS

What is the best way to deactivate the text within a span using angularjs? I'm having trouble with ng-disabled in my situation. Below is the code for the span element: <span ng-click="clickMe()" ng-if="true" ng-disabled="true">Click Me!</sp ...

Steps for triggering a click event on a div with a button role within a class containing multiple elements

Can anyone help me figure out how to auto-click every button in Instagram's "hide story from" settings using console? I tried the following code: for (let i = 0; i < 300; i++) { document.getElementsByClassName('wbloks_1')[i] ...

Is it possible in HTML to create an "intelligent" overflow effect where text is truncated and replaced with an ellipsis "..." followed by a link to view the full content?

I have a <div> that has a limited size, and I am looking for a way to display multiline text in it. If the text exceeds the available space, I would like to add "..." at the end along with a link to view the full content on another page. Is there a ...

What is the easiest way to update the border color of a radio button in Material-UI?

I am looking to customize the appearance of the outer ring on Material UI radio buttons. https://material-ui.com/components/radio-buttons/ Currently, my radio button looks like this: https://i.stack.imgur.com/o67mN.jpg However, I would like it to look ...

How can I fetch a value from a database and set it as the selected option in a

I am facing an issue with the usage of the selectpicker plugin from Bootstrap in order to select multiple items. My requirement is to create a modal for editing where the data is fetched from previous records, particularly an array. I am looking for a way ...

Utilizing Sass variables and customizing CSS styles within the main stylesheet

Hey there! I'm new to sass and I have a specific question about it. Do I need to link the scss file to a separate css file where I'm working, or can I write my styles directly in the same file? I tried using sass variables from Bootstrap 5.3.2, b ...