HTML: Trim the perimeter borders

My goal is to recreate the design shown in the image.

I attempted to achieve this using the border-radius property, but unfortunately I could not replicate it accurately.

Answer №1

If you want to achieve this effect, consider using a background gradient:

.border-red-bottom {
    color: white;
    background: red;
    padding: 10px 10px 40px;
    width: 300px;
    position: relative;
    background: linear-gradient(-3deg, #fff 0%,#fff 40%,#f00 41%,#f00 41%,#f00 100%);
}
<div class="border-red-bottom">Notifications</div>

Answer №2

To effectively achieve this result, using a clip-path is the way to go.

I have included a demonstration of how this method works. Essentially, it allows you to conceal part of an element by utilizing shapes, such as a polygon in this instance.

You will need to provide the coordinates for the four points of the polygon:

0 0 representing the top left point

100% 0 indicating the top right point

100% 48% positioned approximately halfway down the right side

0 100% denoting the bottom left point

div {
  background-color: red;
  color: white;
  width:300px;
  height: 40px;
  -webkit-clip-path: polygon(0 0, 100% 0, 100% 48%, 0 100%);
  clip-path: polygon(0 0, 100% 0, 100% 48%, 0 100%);
  padding:10px 0 0 10px;
}
<div>test</div>

Answer №3

For your crimson component, incorporate the following:

clip-path: polygon(0 75%, 100% 75%, 100% 90%, 0 100%);

If necessary, feel free to tweak the parameters to achieve the desired angle.

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

The fadeOut() function is not functioning properly as the div keeps reappearing even after attempting to

My navigation bar has a unique feature - the subnav expands to fullscreen on hover, while all other subnavs close. However, I encountered an issue with the close button functionality. When clicked, the subnav fades out but then immediately fades back in. ...

PHP function that verifies the post category and dynamically modifies a specific CSS element associated with it (without using WordPress)

Looking for a PHP5 function to determine a post's category and change a part of its style on the homepage accordingly. Any suggestions on where to start? (Not using WordPress) Thanks. ...

Failure of default option to appear in dropdown menu in Angular

I currently have a dropdown list in my HTML setup like this: <select id="universitySel" ng-model="universityValue" ng-options="university._id for university in universities"> <option value="-1">Choose university</option> ...

What is the process for linking an Android application to a particular class within an HTML code?

I have a unique idea for an Android app dedicated to my university. In this app, users/students will be able to enter their student code and password on the login page. By clicking "log in," the app will redirect them to their personalized portal on the un ...

Utilizing commas in JavaScript

Hi everyone, I'm having an issue with printing the message "Invalid password, Must Contain:". The problem I'm facing is that when I write the code in JavaScript, the comma is being interpreted as an operator instead of a regular English comma. Th ...

Getting rid of the scrollbar in Internet Explorer

Instead of just removing the scrollbar, I want to ensure that scrolling capabilities remain intact. This is important because I want to create a 'slide show' effect on the website where users can click 'next' and scroll through content ...

Position the Bootstrap Button on the right side of the navbar

Hey there, I'm completely new to the world of HTML/CSS and this is my first project ever. I welcome any constructive criticism that can help me improve in the future. Now onto my current dilemma: I've decided to use Bootstrap because it seems u ...

What is the best way to make IE 10 display a pointer instead of an I-bar for a select list?

Is there a way to make IE 10 display a pointer instead of an I-bar when selecting from a list? Despite trying various methods found in similar questions, I have been unable to resolve this issue. The cursor: pointer property works as expected on other br ...

Switch from monochrome to color when hovering inside a clipping mask

I have successfully mastered the technique of changing an image from grey to color on hover using CSS and JavaScript. However, I am curious about whether it is possible to achieve the same effect using a clipping mask. Attached is an image that illustrate ...

What is the best way to showcase two data frames side by side in an HTML template or webpage without using frames?

Is there a way to showcase two data frames side by side in an html template? <h3> TITLE </h3> {{stat1 | safe}}. {{stat | safe}} I attempted the above solution, but unfortunately it only displays the data frames vertically stacked instead of ...

What is the reason behind getComputedStyle having visibility set to visible?

What is the reason behind getComputedStyle always returning element visibility as visible even when no explicit visibility has been set? For instance: getComputedStyle($('#block1')[0],null).visibility; --- "visible" Meanwhile: $('#block1&a ...

Webpack will only load images that are referenced within CSS files, and it will not load images that are referenced within

Within my dist folder, you will find index.html, contact.html, index.js, contact.js, and two images referenced by my css as background images. For example: background-image: url("../images/prairie.jpg"); These are the only items in my dist folder. Any o ...

Utilizing box-sizing for the creation of an internal border

Looking to create an HTML table with clickable cells, each containing a div that adds a border upon clicking. The challenge is ensuring the border stays within the boundaries of the td without altering the size of the table or its cells. Struggling to achi ...

Bootstrap 4 ordering feature is non-functional

I am looking to rearrange the layout for Desktop and mobile devices, currently this is how it's structured: On Med+ : https://i.sstatic.net/E9ZHo.png On small: https://i.sstatic.net/VG6j1.png The placement on Desktop is fine. However, on mobile I ...

The date selector is failing to accurately reflect changes in the date objects

I've integrated a date-time picker from this source https://github.com/DanielYKPan/date-time-picker to manage 'beginning' and 'end' date objects (refer to selectedMoments in the TypeScript code) for a date selector. However, when I ...

The issue of the highlighted row not disappearing persists even after clicking on the adjacent table row

When selecting the gear icon for the menu option in a table row, I would like the background to turn yellow. I attempted the following code to highlight the table row: var view = Core.view.Menu.create({ model: model, menuContext: { ibmm: ibmm }, ...

Access the data from a table row when a checkbox is selected

Edit: I want to rephrase my inquiry I am attempting to retrieve the text inside the anchor tags within a <td> when a checkbox is checked. The issue is that the anchor tags do not have an id or class assigned to them. Below is a simplified version ...

The PHP header() function is not properly redirecting the page, instead it is only displaying the HTML

After double checking that no client sided data was being sent beforehand and enabling error reporting, I am still encountering issues. The issue revolves around a basic login script with redirection upon validation. <?php include_once "database- ...

Is it possible to adjust the width and margin without specifying a left or right float?

I am attempting to adjust the width and margins of a tag without using float. I have tried the following code, but it does not seem to be working: .float-right .createAccount{ float: left; margin-left: -11px; width: 140px;} ...

Is the sound persistently playing on every single page?

Can an mp3 continue playing from where it left off when you switch to another page on the same site? I'm feeling lost and not sure how to tackle this. Still learning HTML, CSS, etc. Any thoughts or tips would be greatly appreciated. Thank you! ...