What could be the reason for the failure of a wrapper that is solely based on

I'm struggling to grasp why using percentages isn't functioning in this scenario. Can someone shed some light on this for me?

#wrapper{
    position:relative;
    width:90%;
    height:90%;
    background-color: black;
} 

HTML:

    <body>
        <div id="wrapper">

        </div>
    </body>   

Answer №1

Have you double-checked that the CSS code has been properly implemented?

body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
}

Answer №2

A percentage of the parent container determines the width. Without specifying a width for the body element, it defaults to 0. To address this issue:

body {width:100%;}
#wrapper {width:90%}

As a result, the div will take up 90% of the total screen width.

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

Modify the appearance of the web3uikit component

Looking to style a <ConnectButton> element from web3uikit with custom CSS? I attempted to wrap it in a div with the class "myDiv" and target it using CSS like this: .myDiv button { color:red !important } However, my styling changes aren't being ...

Utilizing the CSS transform scale() function to enlarge an element while preserving its entire content and allowing for scrolling

Check out this live example: https://jsfiddle.net/b8vLg0ny/ You can actually utilize the CSS functions scale and translate to magnify an element. For instance, consider a scenario with 4 boxes arranged in a 2x2 grid. The HTML code for this setup is as f ...

Tips for making search results stand out

Hey there! I've got a search function set up to look for keywords in a database. I'm interested in highlighting those keywords and found a second function that I want to integrate into my search function. This is the current code for the search: ...

Center title with a subtitle beside it

https://i.sstatic.net/giiPr.jpg My goal is to replicate the typography shown above. The main title is centered, while the subtitle is positioned next to the title. I managed to achieve something similar below using Bootstrap's small class. https://i ...

Executing an external JavaScript function from within an internal JavaScript code block

Currently, I am dealing with 2 JavaScript blocks. One is contained within my HTML and handles touch functionality, while the other is an external file serving as a content slider. My goal is to utilize touch events to control the slider - allowing users to ...

Ajax, silently transmitting data without refreshing the page

In one of my files, A.php, there is basic information that includes a form with an input field for email and a button. When the user clicks on the button, it triggers a function in JavaScript. <div class="col-md-8"> <input type="email" class="f ...

Alignment of Bootstrap input groups and buttons

I am looking to have the input group aligned on the left side and the "Add New" button aligned on the right side of the row. <div class="row"> <div class="input-group col-sm-6"> <input type="text" class="form-control" placehol ...

Utilize a DIV element to apply a class to CKEditor

Currently, I am utilizing CKEditor in DIV mode instead of an IFRAME and I am facing a challenge in assigning a class to the editor itself. While I have managed to add classes to elements within the editor, figuring out how to assign one to the editor itsel ...

Angular causing WKWebview to freeze

Situation Our Angular+Bootstrap app is functioning smoothly in Desktop on all operating systems, as well as Android and iPhone devices. There are no visible JavaScript errors or CSS warnings. Dilemma However, an issue arises intermittently while using t ...

Verify the email address for accuracy and display an error message beneath the email input field if necessary

Verify email address format and display an error message below the email input field if it is invalid function validateEmail() { var email = document.getElementById('email').value; var pattern = /^([A-Za-z0-9_\-\.])+\@([A- ...

Using `overflow: hidden` on a table will result in the bottom and right borders disappearing

I am facing an issue where the border of my table is being cut off when using overflow: hidden. Below is an example code snippet illustrating this problem. <style> table { border-collapse: collapse; } table { ...

find the intersection point of two elements

Is it possible to identify the exact point where two elements overlap? Take a look at the code snippet below that demonstrates what I mean: <html> <head> <style> body { height: 100%; margin: 0; padding: 0; ...

Thumbnails failing to line up in a continuous row

Having an issue creating a row with 3 thumbnails as they are not aligning in a single row, instead each thumbnail is going into a different row. echo "<table>"; echo "<tr>"; echo "</tr>"; while($r ...

Steps to generate an excel document from an HTML table and store it in the project folder

I have created an HTML table with loaded data and now I am looking to convert it into an Excel file and save it in the project directory. Below is the HTML Table structure: <table class='tblNemoList' border='1' cellpadding='3 ...

Using jQuery to trigger a Bootstrap modal when a button is clicked

I've been attempting a simple task, but it appears to be unsuccessful. I'm trying to handle the click event of a button inside a bootstrap modal, and so far, nothing happens when clicking the button. My guess is that my jQuery selector for select ...

What is the best way to make the middle div stretch and fill the entire width of the screen while taking into consideration headers and footers?

Check out this JSFiddle link for more details <div class="navbar"> navbar </div> <section> <header>header</header> <div class="chat"> chat window </div> <footer> <textarea ...

What is the best way to position an image using css?

I am looking to position an image on the left side of my homepage using CSS instead of HTML. However, I am having trouble figuring out how to make it work. The image I want to use is called Nobullying.jpg. HTML: <html> <head> <link re ...

Delay the execution using Javascript/jQuery, remove the last element from the DOM

Within a jQuery AJAX call, I am using a $.each() loop. Each element in the response data triggers the addition of a portion of HTML to a container class in my index.html file. To view the code and ensure proper formatting, visit the codepen here as the pa ...

Trouble with displaying Google line chart on Django platform

I am currently working on a project involving the visualization of COVID data. The idea is that when a user selects a specific state, date range, and output type, the corresponding graph should be displayed using Google API to showcase line charts. However ...

Creating a div element with a fixed size that remains the same regardless of its content

Check out the code snippet below for displaying an image and title: <div id="eventsCollapsed" class="panel-collapse collapse" ng-controller="videoController"> <div class="panel-body"> <div ...