Distinctive shaped container edge

I am looking to design a unique HTML box that includes a little tip at the bottom. Using HTML and CSS, I have created this specific design shown in the code below. Take a look.

.item{
  width: 200px;
  height: 130px;
  background: gray;
  background-repeat: no-repeat;
  background-position: center;
  background-size: cover;
  position: absolute;
  float:left;
}
.title{
  position: absolute;
  bottom: 0px;
  background-color: white;
  height: 30px;
  line-height: 30px;
  width: 160px;
}
.tip{
  position: absolute;
  bottom: 0px;
  right: 0px;
  height: 30px;
  width: 40px;
  border-left: 25px solid transparent;
  border-bottom: 30px solid white;
}
*{
  box-sizing: border-box;
}
<div class="item" style="background-image: url('http://img.dummy-image-generator.com/buildings/dummy-400x400-Window-plain.jpg')">
  <div class="title">Lorum Ipsum</div>
  <div class="tip"></div>
</div>

<div class="item" style="left:230px;">
  <div class="title">Lorum Ipsum 2</div>
  <div class="tip"></div>
</div>

The background image also extends into the tip at the bottom. On the right side, you can see a similar design without an image and with a gray background. However, the background should actually be white with a gray border outlining the gray background. This border is necessary for both versions, with and without the image. An illustration of this concept is provided below.

It seems feasible to create this layout using only HTML and CSS while ensuring compatibility with older browsers (at least IE9). Thank you in advance for your help!

Answer №1

Here's a solution that is compatible with older browsers; I've highlighted the borders in red for better visibility.

.item{
  width: 200px;
  height: 130px;
  background: gray;
  background-repeat: no-repeat;
  background-position: center;
  background-size: cover;
  position: absolute;
  float:left;
  border:1px solid red;
}
.title{
  position: absolute;
  bottom: -1px;
  left: -1px;
  background-color: white;
  height: 30px;
  line-height: 30px;
  width: 160px;
  border:1px solid red;
  border-width: 1px 1px 0 0;
}
.tip{
  position: absolute;
  bottom: -1px;
  right: -1px;
  height: 30px;
  width: 40px;
  border-left: 25px solid transparent;
  border-bottom: 30px solid white;
}
.tip-border{
      border-bottom-color:red;
    bottom:0;
}
*{
  box-sizing: border-box;
}

<div class="item" style="background-image: url('http://img.dummy-image-generator.com/buildings/dummy-400x400-Window-plain.jpg')">
  <div class="title">Lorem Ipsum</div>
  <div class="tip tip-border"></div>
  <div class="tip"></div>
</div>

<div class="item" style="left:230px;">
  <div class="title">Lorem Ipsum 2</div>
  <div class="tip tip-border"></div>
  <div class="tip"></div>
</div>

http://fiddle.jshell.net/2bgdjckq/

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

How can CSS be effectively handled across master pages, content pages, and user controls?

When working on a web project that includes content pages, master pages, and user controls, what are the best practices for writing CSS for each of these elements? Should it be included in the page itself, or in a separate file? Is it better to have a sepa ...

Dynamic row addition in Material Design Lite table causes format to break

Here's the HTML markup for creating a checkbox using material-design-lite: <label class="mdl-checkbox mdl-js-checkbox mdl-js-ripple-effect" for="checkbox"> <input type="checkbox" id="checkbox" class="mdl-checkbox__input" /> <span c ...

Compiling 'react-scripts' to include a few images as data URIs within the CSS file

I have recently inherited a sizable React project, even though my experience with React is limited. Nonetheless, I am attempting to make improvements in areas where I feel confident. An ongoing issue we are facing is the excessive size of our main CSS fil ...

Whenever I attempt to update content in my database using an HTML form, I encounter an issue where if I enter a single quote character in the input field, the SQL update operation fails

Whenever I fill out a basic form and include an apostrophe or single quote, the query breaks and the data is not added to my database. How can I prevent this issue? Form Example <form method="POST" action="#"> <table> < ...

Hiding the SVG element with pattern definitions using the 'display: none' property makes the patterns completely disappear from view

When I include a set of SVG definitions at the top of my body, I encounter an issue where the svg tag with zero height and width creates unnecessary space at the beginning of the document. To resolve this, I initially use display:none, but this leads to pr ...

Turn off the second dropdown menu if the first one has not been chosen

I need to implement a feature where the second dropdown is disabled if the first dropdown is not selected. Is there a way to achieve this using JavaScript? The requirement is that if the user does not select an option from the first dropdown, the second dr ...

Tips for transferring an element from different components to a designated component in React.js

In my project, I have a <Header> component and another component called <AboutMe>. My goal is to select an element by its ID from the <AboutMe> component and attach an event listener for onClick. However, whenever I attempt to use getEl ...

Styling: petite vibrant square positioned in the corner of a large container

Can you please take a look at the screenshot from the demo app: box over box image I am trying to create a colorful small square box that will appear in the top left corner, on top of the larger parent square box (including all the contents inside the whi ...

Guide on creating a dynamic slideshow viewer

I'm interested in learning how to implement a sliding image viewer using javascript or jquery. Based on what I've observed, these viewers feature images aligned side by side with buttons that shift the images depending on their width to display t ...

Simply by loading Bootstrap, it is causing the animation parameters to become disrupted

Currently, I am experimenting with implementing a frontend code I discovered online for simulating a dice roll. If you are interested, you can find the code in this repository: https://codesandbox.io/s/xjk3xqnprw?file=/styles.css:0-4535 Here is the HTML ...

What is the best way to include personalized attributes in a form_for?

Here is the code I am working with: <%= form_for @quiz do |f|%> <% @questions.shuffle.each do |q| %> # get_answers returns an array of 4 random answers <% answers = q.get_answers %> <%= f.label q.inquest %><br> ...

Display or Conceal Multiple Divisions Using Angular 2

I am looking to implement a functionality using Li lists to toggle the visibility of multiple divs in Angular 2. Initially, all divs on the page will be visible. When viewing on a smaller screen, I want to hide some divs and show a specific div when a cor ...

"Utilizing jQuery to Trigger CSS3 Transform Animation Replays After a Set Number of Iterations

I currently have an animated image set up like this: <div class="image_for_sping"> <img src="/anyimage.png"> </div> The image has a style attribute added by jQuery which contains the following animation properties: animation: spin3 ...

What is the best way to select an HTML tag element using the :v-deep() selector?

When I utilize the following: ::v-deep img { ... } it functions but triggers a deprecation warning: [@vue/compiler-sfc] ::v-deep usage as a combinator has been deprecated. Use :deep(<inner-selector>) instead. How can I achieve the same effect using ...

Exporting data from AngularJS to Excel is not functioning correctly in Internet Explorer. Additionally, the exported Excel file does not display properly in Firefox and

I have been attempting to Export a table from a jsp page to Excel using AngularJs. Is Angularjs not compatible with IE? I am also encountering this error SCRIPT5009: 'Node' is undefined In Chrome and Firefox, the Excel file only opens when save ...

Modify an HTML table and record any modifications as POST requests using Javascript

As a beginner in JavaScript and HTML, I am open to corrections if I am not following the correct practices. Recently, I delved into editing an HTML form table. {%extends 'base.html'%} {%block content%} <html> <body> <h4> Search ...

During the Internet Explorer browser, the command will run two times

<div style="width:expression(alert('1'));"></div> When this code is executed in IE7, it will trigger the alert function twice. Why does this happen? ...

Trigger the click event on the ul element instead of the li element using jQuery

Is there a way to make the click event only affect ul tags and not all li elements using jQuery? <!-- HTML --> <ul class="wrap"> <li>test1</li> <li>test2</li> <li>test3</li> </ul> I attemp ...

Ways to update the HTML layout for certain components using the Selenium driver

Even though I am still learning about selenium, it appears that the driver initially caches the HTML, causing any subsequent modifications to go unnoticed (unless the page is refreshed). This is a snippet of what my HTML code looks like: <div class="q ...

Retrieve data from backend table only once within the bootstrap modal

How can I retrieve values from a table once a modal is displayed with a form? I am currently unable to access the values from the table behind the modal. Are there any specific rules to follow? What mistake am I making? I would like to extract the values ...