Ways to even out the base of a tilted vessel?

My container is currently transformed with

transform: skew(0deg, -3deg )translateY(-6vh)
, but since I am using it as a footer, I would like the bottom part to be completely flat. Is there a way to achieve this without placing another container on top with the same background color? I want to maintain responsiveness and avoid any layout issues.

Answer №1

Utilizing the ::before pseudo element was my initial approach. However, I encountered difficulty in positioning it below the main element, resulting in a slight loss of space.

Unfortunately, my attempt at using ::before was quite unsuccessful. Furthermore, there were some peculiarities when using transform, especially noticeable when applying a background color on the element and viewing it on a wide screen.

Instead of struggling with this issue, I recommend using an SVG to achieve the desired slant effect. I did encounter a strange gap between the svg and div, but I managed to work around it by adjusting the positioning.

Feel free to adjust the values to customize the slant to your preference, keeping in mind that it may appear differently based on the screen width.

#footer {
  position:relative;
  overflow:hidden;
}
svg {
  width: 100%;
  fill: green;
  max-height: 50px;
  position:absolute;
  top:0;
}

#footerContent {
  margin-top:49px;
  height: 100px;
  background: orange;
}
<div id="footer">
  <svg viewBox="0 0 100 20" preserveAspectRatio="none">
    <polygon points="0,20 100,20 100,0" />
  </svg>
  <div id="footerContent"></div>
</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

Is there a way in CSS to set a label's width equal to the width of its content?

I am facing an issue where I need the question mark div to be positioned right next to the top row of text in the label it is associated with. Can someone suggest some styles that can be applied to the label to adjust the width and spacing so that it match ...

Unable to stop the default form submission in Vue 3

Using the latest version of Vue 3 I am encountering an issue with preventing form submission. Here is my HTML form: <form id="app" @submit="onSubmit"> <input type="text"> <input type="text"> ...

Is it possible to have the website show up at a default size of 90% on the display

My preference is for my website to appear at 90% instead of 100%. This seems to be a common occurrence for me. Is there a way to have it default to this appearance? ...

Tips for positioning your datepicker to align to the left

Can anyone please help me? I am struggling with positioning the datepicker on Bootstrap. I want it to be aligned to the left but it's not working as expected. Can someone please assist me in improving the logic below? Also, I need help in changing the ...

Align Bootstrap 4 dropdowns with their parent element

Is there a way to match the width of a bootstrap dropdown menu with its parent input group? <div id="ddl_1" class="input-group"> <input type="text" class="form-control "> <div class="input ...

Could you please advise me on where I should apply line-height in order for it to work properly?

My div is structured like this: https://i.sstatic.net/3fUNs.png I am trying to decrease the spacing between the lines. I attempted adding a line-height attribute to both the parent div and one of the label elements like this: <div class="row" ...

Choose a specific <div> element from an external page using Ajax/PHP

I'm encountering a small issue. I am currently utilizing Ajax to dynamically load content from another page into a <div> element after detecting a change in a <select>. However, my specific requirement is to only load a particular <div& ...

Executing a JavaScript function to submit an HTML form and circumvent the default behavior

Currently, I am utilizing a virtual keyboard that was created using JavaScript for the user interface on an embedded system. If you would like to access the source code for this virtual keyboard, you can find it here: https://codepen.io/dcode-software/pen ...

Converting multi-dimensional array into a structured table format

Query about arrays: Here is the array structure I am working with: Array ( [0] => Array ( [0] => Project [1] => Time ) [1] => Array ( [0] => Google [1] => 2 ...

Oops! Looks like there was an error: weight is not defined when trying to calculate BMI with the HTMLButtonElement

I'm currently working on a project to create a BMI calculator following specific instructions. I've managed to follow all the guidelines except one regarding the letsCalculateBMI function. The instruction states: letsCalculateBMI should extrac ...

The HTML div is not aligned in the center even when using flexbox

After creating a list within a centered flex div, it seems that the list is not aligning properly. I used flex on the list-div2 and the translate rule in the parent's middle-text div, but it still doesn't look centered as expected. Can anyone p ...

Cannot retrace steps in file tree using ../

My website has a file structure set up like this: css style.css other files... templates index.html other files... I am attempting to reference the style.css file from my index.html document. My initial attempt was to navigate back a directory u ...

Show content based on information from an array using JavaScript

I am currently working on developing a user-friendly step-by-step form using AngularJS and UI-router to navigate through different sections. The data collected from each form is stored in a JavaScript array, and I am trying to dynamically show or hide a di ...

Why is the image cut in half on mobile devices but displaying correctly on computer screens? Could it be an issue with

There seems to be an issue on mobile screens that does not occur on computer screens. When the user clicks on the image, it disappears, and when they click another button, it reappears. However, there is a problem with how the image appears - it is cut off ...

Customizing the navbar to be inverse on each webpage using CSS, PHP, and Bootstrap

Dealing with a Bootstrap navbar across multiple pages on my website is becoming a hassle. Every time I need to make a change, I find myself jumping from one page to another just to update it. My objective is to have the ability to edit the navbar in one ce ...

Resolving Conflicting CSS Styles

It's frustrating to constantly have to ask questions. I've been struggling to implement code on my website, but every time I try to add something new, it just doesn't work. I even tried changing the CSS names, thinking that might solve the i ...

Searching and extracting HTML tags using DomCrawler

Trying to extract text content from HTML tags using the Symfony DomCrawler <html> <strong> This is a bold text </strong> <strong> This is another bold text </strong> <h2> This is header 2 text </h2> </htm ...

Issue with PHP retrieving initial value of post data

Hi there, I am facing an issue with my PHP code where the first value of the input field is not being displayed. However, when I check the console.log, it shows correctly. Here is my console.log output: https://i.sstatic.net/eZvg6.png PHP Output: https ...

Encountering issues with implementing useStyles in Material-UI components

Currently, I am working on a project utilizing Material-UI's library and encountering styling issues. This project marks my initial venture into ReactJS and JavaScript in general. Therefore, any assistance would be greatly appreciated! I am struggli ...

Center or left-align the divs

Can anyone offer assistance with this section of code? HTML: <div id="holder"> <div class="box"> </div> <div class="box"> </div> <div class="box"> </div> <div class="box"> </div> </div> ...