Achieving an inward, see-through arrow effect using CSS

I am trying to create an inward arrow using CSS, similar to this example: https://i.sstatic.net/w3ray.png

The triangle shape is achieved using a pseudo-element with the following CSS:

section.intro:after {
    top: 100%;
    position: absolute;
    content: " ";
    pointer-events: none;
    width: 0;
    height: 0;
    margin-left: -.75em;
    bottom: -2em;
    left: 50%;
    border: 1.5em solid #000;
    border-color: transparent transparent #fff #fff;
    -webkit-transform-origin: 0 0;
    transform-origin: 0 0;
    -webkit-transform: rotate(-45deg);
    transform: rotate(-45deg);
    -webkit-box-shadow: -5px 5px 5px 0 rgba(0,0,0,.25);
    box-shadow: -5px 5px 5px 0 rgba(0,0,0,.25);
}

This solution works but I need to maintain the background, so I altered the border-color property like this:

border-color: rgba(255, 255, 255, 0);

The updated result can be seen here: https://i.sstatic.net/4kfGY.png

However, when I try to apply a box shadow to the entire bottom part of the section, it creates this effect: https://i.sstatic.net/DHQuu.png

Now I am faced with two issues:

1) How can I prevent the box shadow from covering the pseudo element?

2) How do I remove the excess background outside the shadow area?https://i.sstatic.net/hxPUD.png

EDIT: Here is the HTML code for the entire section:

<section class="background intro section-padding">
    <div class="content horizontal horizontal-even">
        <div class="small-center">
            <h1 class="h1 font-bebas-book">random text</h1>
            <p>random text</p>
            <a class="button button--with-shadow" style="display: block; width: 150px">Text</a>
        </div>
        <div class="small-center">
            {{>animation}}
        </div>
    </div>
</section>

The section background is simply a background-image.

The pattern consists of small icons repeating throughout the section.

Answer №1

To create this effect, you can use a combination of the clip-path property and the drop-shadow() filter. Apply the clip-path to a pseudo element in order to avoid cutting off the drop shadow:

.box {
  margin: 20px;
  height: 100px;
  position: relative;
  filter: drop-shadow(0 2px 4px red);
}

.box::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: url(https://picsum.photos/200/300?image=1069) center/cover;
  clip-path: polygon(0% 0%, 100% 0%, 100% calc(100% - 30px), calc(50% + 30px) calc(100% - 30px), 50% 100%, calc(50% - 30px) calc(100% - 30px), 0 calc(100% - 30px));
}
<div class="box"></div>

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

Creating a canvas with multiple label introductions can be achieved by following these

I am looking to group labels and sublabels on the x-axis of a canvas component. Currently, I only have sublabels like: RTI_0, RTI_1... I would like to add labels to these sublabels like: RTI = {RTI_0,RTI_1,RTI_2] BB = {BB_0, BB_1,BB_2,BB_3] <div cla ...

"The HTML5 feature that triggers an event when a selection is changed is known as

Is there a universal HTML5 event that functions similarly to the IE legacy onselectionchange, triggering when the current selection is altered? UPDATED, I am interested in monitoring changes to the Selection object. ...

Attribution of image in footer

The image above the footer is not displaying properly. Screenshot: Image appears below the footer https://i.stack.imgur.com/RvSqI.png Source Code .footer-area { background-position: center; position: relative; z-index: 5; } .footer-area::before { ...

What is the best way to eliminate the gap beneath v-app-bar in Vue.js?

Is there a way to eliminate the space below v-app-bar? the header segment User_Header.vue <template> <v-app id="user_header"> <v-app-bar app color="#8a0303" dark> <h1>this is app bar</h1> & ...

How can I extract and display chosen values from multiple dropdown menus in designated text boxes based on their unique identifiers?

A website for evaluating car values is in the works, using a combination of PHP, MYSQL, JQUERY, and JavaScript. The database includes 3 tables: Table "car_make": id make 1 BMW Table "model": model_id model_name make_id 1 M3 1 Table "ca ...

The .fixed-top navbar in Bootstrap conceals various elements behind it

Hey there, I'm hoping you're doing well. I've run into a little issue with Bootstrap that I was hoping to get some help with. According to the Bootstrap documentation, it seems like .sticky-top may not be supported by some browsers anymore. ...

CSS navigational sprite technology

Can three images be used in CSS sprite navigation? Something like this perhaps: Check out my image here: http://img710.imageshack.us/img710/1429/navigx.jpg If it is possible, what would the outcome look like? ...

What is preventing selenium from locating a button within a Python Chrome Extension?

Currently, I am utilizing BeautifulSoup in conjunction with Selenium. My approach involves opening a webpage using Selenium along with a Chrome extension. Upon manually right-clicking and selecting 'inspect' on a button, I can view the HTML code ...

Attempting to insert information into a SQL database table by utilizing PHP and HTML through a registration form

I have exhausted many options and conducted numerous searches without finding a solution. My goal is to utilize an HTML form to submit data to a SQL table. Below is the code for my register.php file: $con = mysqli_connect("localhost", "database_name", "p ...

The transparency of the navigation menu is perplexing to me. I am unclear as to the reasoning behind it. I desire a

I am currently using a pre-made WordPress theme. Recently, I incorporated particles.js as the background for my website. The issue I am facing now is that my navigation menu is blending into the same color as the background. I have tried defining a separat ...

Utilizing PHP and Ajax to Transfer Selected Option into Input Field

I need a solution to automatically transfer the selected value/option from a drop down menu into an input field without any page refresh. Ideally, I would like this functionality to work seamlessly without requiring an extra button click, so that the val ...

Using Document.querySelector() in combination with Bootstrap CSS may lead to unexpected results

CSS & HTML <html lang="en"> <head> <title>Document</title> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384x ...

Chrome glitch: how to make radio buttons bigger

Hey there! I'm having a little trouble trying to increase the size of my radio button using this CSS code. It seems to work in Mozilla, but not in Chrome. .rdo { margin: 1em 1em 1em 0; transform: scale(1.3, 1.3); -moz-transform: scale(1.3, 1.3); -ms- ...

Issue with Displaying Background Image

When trying to set my background image on CDM using document.body.style={mainBg}, I am not getting the expected result. Additionally, the console statement below it is printing out an empty string. Can anyone assist me in identifying what mistake I might b ...

Retrieve the folder name after selecting the folder in the input field

I have used the code snippet below to select a folder and parse all the files within that folder. While I am able to retrieve a list of all files, I am unsure how to extract the folder name alone from the path. For example, if the folder path is C:/Folder ...

Manipulating the arrangement and alignment of div elements within a designated container

Here is the markup I am working with: <div class="container"> <div class="left-rect"></div> <div class="text">Lorem ispum</div> <div class="right-rect"></div> </div> .left-rect, .right-rect { ...

One way to retrieve this attribute with jQuery is by specifying the div element in question

I am facing an issue with a div that is defined within a particular context. Let's consider the div as shown in the code snippet below: <td itemid='desired number'> <div>div 1</div> <div class="action">div 2</ ...

Embedded Twitter posts are not showing up correctly when using vue

My backend is Django and frontend is Vue. In one of my models, I have a rich text editor. When saving the content, it converts tweet links to embedded HTML tweets. While displaying this content in a div with v-html binding in Vue, everything appears as exp ...

Is there a way to display the # symbol instead of characters in the input text field?

I have a text input field in a PHP page with a maxlength attribute set to 11. This input field is specifically used for entering phone numbers. The requirement is that when the user types a phone number, it should display as "#" symbols for all 11 characte ...

Explain the usage of Razor syntax when defining the name attribute in HTML

Currently, I am utilizing MVC 5 and Razor 3 to dynamically generate an attribute name in HTML using Razor syntax. Specifically, I am focused on creating a data-* attribute. This pertains to determining the name of the attribute rather than its value. Her ...