What causes a space to appear at the bottom of the screen when elements exceed the height of the screen?

https://i.sstatic.net/jo7W5.png

https://i.sstatic.net/Au7OW.png

After passing the screen height, I noticed a sudden margin-end appearing. I've tried using '''cover: 100% 100''', but the image ends up shrinking. As my framework is Bootstrap, I'm facing this issue.

I also experimented with,

'''width: 100%; height: auto; '''

However, this didn't solve the problem either as whenever I add more elements, the image's height adjusts itself to fit them.

Below is my CSS code snippet:

''' body { background-image: url('Media Files/Images/JPG/BG\ photo\ of\ the\ home\ page.jpg'); background-size: cover; width: 100vw; height: 100vh; margin: 0; padding: 0; background-position: center; box-sizing: border-box; background-repeat: no-repeat; font-family: 'sen', sans-serif; background-blend-mode: multiply; } '''

Answer №1

One helpful CSS tip is to set the default margin and padding of all elements to 0. This can often solve spacing issues on your website. Give it a try:

*{
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

Answer №2

html {
overflow-x: hidden;

}

The issue was fixed by adding this CSS code snippet

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

Using javascript, what is the best way to clear a text field with a specific condition?

When I clear the text field #t1, I expect text field #d1 to also clear. However, the last two lines of code do not achieve this result. function utl() { var tField = document.getElementById('t1'); var dField = document.getElementById(&a ...

Utilizing Django framework for crafting a captivating homepage

Successfully set up the django framework and developed an app for my homepage. I added the app to the settings in the project folder and was able to get the HTML running smoothly. However, I am experiencing issues with styling as the CSS won't apply. ...

Conceal the horizontal scrollbar when the navigation menu is minimized

Explaining this concept may be a bit challenging, so I have included a jsfiddle demo. The issue at hand involves a bootstrap nav menu that shifts to icons when not active and expands to include words when focused. When the menu is expanded, there are no sc ...

A guide on customizing the appearance of individual items in a vue v-for loop based on specific conditions

I am currently developing a multiple choice quiz game and I want the selected answer by the user to change color, either red or green, depending on its correctness. To achieve this, I have created a variable called selected that correctly updates when the ...

Create a web design where two HTML elements with full width are positioned to overlap each other,

I am facing a design challenge where I need sections to span the full width of the page, but the content is contained within an article. Additionally, there is an interactive aside that needs to float above the full-width sections. Both the article and as ...

Is there a method to exclude children objects from spring animations during application?

Is it possible to create a fading in and out effect for a div (for example, to cycle through different backgrounds) while keeping its children (such as text) visible at full opacity at all times? {transitions((style, <animated.div class={ bg[i] + ...

Navigating to different sections of a single page using Bootstrap

I'm feeling a bit lost when it comes to understanding how linking to an element within a page functions. As I delve into the starter template for Twitter Bootstrap, I encounter the following code snippet in the navbar: <ul class="nav navbar-nav"&g ...

Dynamically showing a div using JavaScript and AJAX after changing the window location

After successfully fetching data from the server through AJAX, I am redirecting to the same screen/URL. Is it possible to show/display a div after redirecting using jQuery? $.ajax({ type: "POST", url: action, data: form_data, success: func ...

What is the best way to modify the selection text background with CSS?

Does anyone know the method for modifying the selection text background in CSS? Many modern websites opt for a personalized background color instead of the traditional blue? ...

Click to reveal sliding menu bar

Trying to create a sliding menu bar (.top-bar) that activates when clicking an arrow (#hide), causing the arrow to also slide up and switch from an up arrow to a down arrow. Here is my unsuccessful attempt: $(document).ready(function(){ $("#hide").c ...

Steps for modifying a cell within a table using a button click

Hello, I am currently working on a project where I want to display a specific div portion when a user clicks on an image icon within a table. However, I am encountering an issue with the JavaScript code as it only shows the div portion in the first row and ...

Definitions that are displayed dynamically when hovering over a particular element

I am seeking a way to implement popup definitions that appear when a div is hovered over. My website showcases detailed camera specifications, and I want users to see a brief definition when they hover over the megapixel class called '.mp'. One o ...

Use the nobr HTML tag on Django form fields

I have been customizing Django form fields using this helpful guide. Here is the form structure: class contact(forms.Form): first_name = forms.CharField() middle_name = forms.CharField() last_name = forms.CharField() This is how the template ...

Creating a split button can be enhanced by incorporating a disabled button with a tooltip feature

I am attempting to create a split button using Material UI components such as ButtonGroup and Button. You can find more information about split buttons here. The issue I am facing is that the first button may need to be disabled and display a tooltip when ...

How to toggle a modal in Bootstrap 5 using JavaScript

When I initiate the modal using the code snippet below document.getElementById('openLoginFormBTN').addEventListener('click', function (event) { let loginFormModal= new bootstrap.Modal(document.getElementById('loginModal&apo ...

I'm just starting to delve into React and I am eager to transform my regular JavaScript code into a React format. However, I am not quite sure how to

In my React JavaScript, I am trying to insert some regular JavaScript code. I attempted to use the {} brackets, but it did not work as expected. import './App.css'; function App() { return ( <> <div className=" ...

Switch up div content - advertisements at the top or bottom

An issue has arisen where the ads on a website are currently being displayed at the bottom of the source code, but they should actually be visible at the top. Here is the ad placeholder code: <div id="300_250_placeholder"></div> And here is ...

Issues with CSS rendering font in a suboptimal way

Whenever I set a simple font rule for my text, the output is not displayed correctly and appears blurry. The font looks fine in Mozilla Aurora browser but displays poorly in newer versions of Google Chrome and Firefox. Does anyone know why this happens? I ...

What's causing these flex items to not wrap around properly?

I'm facing an issue with a flex item that also acts as a flex container, .sub-con. The problem is that the flex item within .sub-con is not wrapping even after applying flex-flow: row wrap. Is there anyone who can help me resolve this problem or iden ...

Achieve full height without scrolling in React

I am facing an issue where the height:100% property is not working to fill the remaining area on the screen. A red outlined area represents the border radius, while the highlighted yellow space should have been filled: https://i.stack.imgur.com/ZQNkw.png ...