What is the best way to apply box-shadow specifically to the bottom of a div element using css?

I'm looking to apply a box-shadow to only the bottom of a div element using CSS. The desired effect is shown in the image below: https://i.sstatic.net/L2vK4.png

I want to achieve the red line indicated in the picture above.

Here's my current code:

<div class="wrapper">
    <div class="container"> //this needs box-shadow at the bottom
        <span class="text">sometext</span>
        <div class="description">some big description</div>
    </div>
</div>

.wrapper {
    position: absolute;
    bottom: 32px;
    width: 316px;
    height: 225px;
    background: white;
    box-shadow: 0px 0px 6px rgba(0, 0, 0, 0.29);
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    opacity: 1;
}

.container {
    height: 101px;
    width: 316px;
    padding-top: 16px;
    padding-left: 16px;
    border-radius: 16px 16px 0 0;
    box-shadow: 0px 0px 6px rgba(0, 0, 0, 0.29); //this adds boxshadow to all sides
}

.description {
     height: 42px;
     width: 289px;
     margin-top: 8px;
     color: black;
     display: flex;
     font-size: 12px;
     font-weight: 400;
     margin-bottom: 16px;
 `;

The current code applies box-shadow to all sides of the container class. I'm seeking assistance on how to selectively add it only to the bottom. Any help would be greatly appreciated. Thank you.

Answer №1

Consider updating your .wrapper CSS to this:

.wrapper {
    height: 101px;
    width: 316px;
    padding-top: 16px;
    padding-left: 16px;
    border-radius: 16px 16px 0 0;
    -webkit-box-shadow: 0px 10px 5px 0px rgba(0,0,0,0.75);
    -moz-box-shadow: 0px 10px 5px 0px rgba(0,0,0,0.75);
    box-shadow: 0px 10px 5px 0px rgba(0,0,0,0.75);
}

Keep me posted on the outcome.

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

What is the best way to customize bootstrap styles?

Currently, I am attempting to modify basic CSS attributes within the default theme that is included with a new ASP.NET MVC 5 application in Visual Studio 2013. Specifically, my goal is to change the background color of the navigation menu. With the help o ...

How to customize the background color of a hyperlink in an HTML email using Outlook 2010

The background color (shown in red) is currently only applying to the text within this link, rather than the entire link. Additionally, there is padding present on the link. This specific issue pertains to Outlook 2010. If anyone has insight on how to e ...

Issue with JSON/Java not refreshing innerHTML when onClick event occurs

I'm having an issue with my JavaScript code: <script type="text/javascript"> $(document).ready(function() { $('#domaincheckbutton').click(function() { var finalMessage = document.getElementById('finalMessage'); ...

slow loading background slideshow in css

Creating a simple slideshow for the background using CSS has been successful, but I am facing an issue with making all backgrounds utilize background-size: cover. I want the images to fit properly on the screen. Another problem is that the pictures take a ...

How tall can an image be to load successfully on an iPad website?

Similar Query: Max image width in Mobile Safari? Dealing with unwanted downscaling on panoramas What is the maximum height an image can be loaded at on a website when viewed on an iPad? I've tried loading an image (a sprite) with a height exceeding ...

Locking the top of a Div in place at the bottom of its Parent div

I encountered an interesting issue when trying to position a div element. To position the child div B inside the parent div A, I have been using relative and absolute positioning. While I know how to align their bottom edges using bottom: 0px, I need to f ...

Customize Color of Bootstrap Tooltips

Is there a way to customize the appearance of BootStrap tooltips by changing the color and aligning the text to the left? I've tried various CSS modifications from different posts, but none seem to work. Any idea on how to alter the CSS of the tooltip ...

implementing css class in javascript

I've been attempting to utilize a plugin for select functionality, but I'm running into issues with the CSS not applying when I insert the class within JavaScript: The plugin I want to use via JavaScript: $('.search-test').SumoSelect ...

Incorporating personalized CSS into Drupal 7 for concealing the notice

Utilizing my custom block to showcase a flash game on the main page of my Drupal 7 setup, I encountered an irksome message: <div id="first-time"><p>No front page content has been created yet.</p> <div class="item-list"><ul>&l ...

Tips for transitioning from custom CSS to Material UI's CSS in JS

I came across a project where someone implemented components with custom CSS. One interesting thing I noticed was a wrapper component, similar to Material UI's Container or just a simple div with applied styles. export const Container = styled.div` ...

Arrange divs adjacent to each other without any gaps in between

My HTML code includes elements from Twitter Bootstrap and AngularJS framework. <div class="item item-custom-first"> <select class="form-control" style="display:inline; float:right" ng-model="requestdata.units ...

Styling the content within Template Strings is not supported by VSCode

Recently, I've noticed that there are two scenarios in which my VSCode doesn't properly style the content within my template strings. One is when I'm writing CSS in a JavaScript file, and the other is when I'm fetching data from GraphQL ...

When using Selenium to locate a sub element within a previously obtained WebElement using xpath, it will always return the first match found on the entire

Currently, my project involves using selenium and python to automate website testing. I am facing an issue while trying to extract links to files on the website using the following approach: I first use divs = find_elements_by_css_selector("div.answer") to ...

Making absolute positioning responsive in Bootstrap 4 - a comprehensive guide

I am looking to enhance the responsiveness of my page, especially on smaller screens. Currently, I have not utilized bootstrap for this purpose. I am contemplating whether I should use it or not. Can I utilize bootstrap for absolute positioning? Thank yo ...

Implementing both inset and external box shadows on the same div element

Is it possible to apply both inner and outer box shadow to the same div element? I've attempted it but it doesn't seem to be working as expected. http://jsfiddle.net/CWuw8/ div{ top: 100px; position: absolute; left: 100px; hei ...

Is it feasible to exclude certain CSS files in an HTML Master page within the .NET framework?

On my website, I have 6 CSS files linked, but on a specific page, I only need to use 3 of them. Our developers are using a master page in .NET and are hesitant to make changes to it. Therefore, I am wondering if there is a way to exclude certain linked C ...

Successfully transferring canvas image to server. Saving empty picture file

I have a piece of code that creates an image from an equation editor when the save button is clicked and displays it on a canvas. However, after displaying it, I am having trouble saving it as the saved image appears blank. Can someone please help me ident ...

Display the div only when the radio button has been selected

I have been attempting to tackle this issue for quite some time now, but unfortunately, I haven't had any success. My goal is to display a specific div on the webpage when a particular radio button is selected. While I have managed to achieve this by ...

Is the form validation failing to update after an item is removed from the model? Possible bug detected?

Lately, I've been exploring AngularJS and encountered an interesting bug. Let me start by sharing some functional code: View: <body ng-controller="MainCtrl"> <form name="form"> <div ng-repeat="phone in phoneNumbers"> ...

Choosing the :after pseudo element that comes after the p element within the container's previous element

Currently, I have a specific HTML code that is not editable: <div> <input type="text" id="name" /> </div> To add a label after the input using CSS (since "after" doesn't work on input fields), I do the following: div:after { ...