The footer element is missing from the body section of the HTML code, causing the box shadow to not encompass the footer as intended

Having a problem in CSS where the footer is not appearing within the body element in the HTML code. The footer is placed between the body tags, but the box shadow defined for the body is not being applied to the footer. The code snippet below shows the CSS styling for the body with box shadows, but the footer lacks the same styling. Here is the code:

body {
  font-size: 87.5%;
  width: 800px;
  display: block;
  margin: 0px auto;
  box-shadow: 3px 3px 3px black;
  border: 3px solid black;
  background-color: white;
}
<!DOCTYPE html>
<html lang="en>
...

Answer №1

When using a box-shadow, it is important to note that it appears outside of the border. If the box-shadow is applied to the body element and the body completely fills or even overflows the screen (filling the html element), the box-shadow may be cut off. This is because the box-sizing property only includes the content area, padding, and border, but not margins and box-shadows.

In this snippet area, the width is less than the 800px defined for the body, which already extends the width of the viewport (snippet area). Additionally, the height is more than the default height of the snippet area.

However, if the body element is made narrower than the screen or the html element, and some padding-bottom is applied to the html element, there will be space for the box-shadow on the body:

html {
  padding-bottom: 6px;
}
body {
  font-size: 87.5%;
  width: 550px;
  display: block;
  margin: 0px auto;
  box-shadow: 3px 3px 3px black;
  border: 3px solid black;
  background-color: white;
}
<!DOCTYPE html>
<html lang="en>

<head>
  <title> The Halloween Store </title>
  <link rel="stylesheet" href="main1.css">
  <link rel="stylesheet" href="normalize.css">
  <meta charset="utf-8">

</head>

<body>

  <header>
    <img src="favicon.ico" alt="Pumpkin" height="80">
    <h2>The Halloween Store</h2>
    <h3>For the little Goblin in all of us!</h3>
  </header>
  
  <main>
    <h1> Welcome to my site. Please come in and stay awhile. </h1>
    <p>I started this website because Halloween has always been my favorite holiday. But during the last year, I started selling some of my favorite Halloween products, and they've become quite a hit.
    </p>
    <p>If you click on the Personal link, you can browse my favorite Halloween pictures, stories, and films. And if you join my email list, I will keep you up-to-date on all things Halloween.
    </p>

    <h3>Product categories</h3>

    <ul>
      <li><a href="Products/Props.html">Props</a></li>
      <li><a href="Products/Costumes.html">Costumes</a></li>
      <li><a href="Products/Special_effects.html">Special Effects</a></li>
      <li><a href="Products/Masks.html">Masks</a></li>
    </ul>

    <h3>My guarantee</h3>

    <p>If you aren't completely satisfied with everything you buy from my site, you can return it for a full refund. <b>No questions asked!</b> </p>

  </main>

  <footer>

    <p>&copy; 2016 Ben Murach</p>

  </footer>

</body>

</html>

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

Building a loading bar using dots

<span class="dot"></span> <span class="dot"></span> <span class="dot"></span> <span class="dot"></span> <span class="dot"></span> <span class="dot"></span> <span class="dot">< ...

Remove the class upon clicking

I recently created a toggle-menu for my website that includes some cool effects on the hamburger menu icon. The issue I am facing is that I added a JavaScript function to add a "close" class when clicking on the menu icon, transforming it into an "X". Whil ...

"The combination of Windows, @font-face, and Cyrillic characters presents a

I am encountering an issue with font-face and Cyrillic characters. The fonts display properly in any browser on OS X, but fail to render on a Windows 7 machine (chrome, ie etc). Even after putting the fonts through Font Squirrel and testing the demo files ...

Concealing and wrapping text using CSS in a table structure

My table is displayed below: <table style="width: 100%; white-space: nowrap; overflow: hidden;"> <tbody><tr> <th> Department </th> <th> Function </th> ...

jQuery will envelop the HTML elements in an inconsequential div

Imagine a website that is visually complex, with various styles and images positioned in different ways. What if we wanted to add a small overlay icon above each image? At first, the solution might seem simple - just use absolute positioning for a span el ...

arranging a collection of images based on their values in increasing order

cardShop is a container with various images, each with its own unique ID and value attribute. These values consist of two numbers separated by a comma, such as 2000,500 or 1500,200. My goal is to sort these images in ascending order based on the first numb ...

Learning how to effectively incorporate two matSuffix mat-icons into an input field

I'm currently experiencing an issue where I need to add a cancel icon in the same line as the input field. The cancel icon should only be visible after some input has been entered. image description here Here's the code I've been working on ...

Adjust the JavaScript variable upon pressing the "c" key

I'm trying to figure out how I can toggle the value of variable x in JavaScript when the key "c" is pressed. Specifically, I want x to change from 0 to 1 when "c" is pressed and revert back to 0 when it's released. I have already defined and name ...

What is the best way to maintain the CSS3 animation state following ng-animate?

Attempting to alter the state of a div using ng-animate along with CSS3 transitions. The animations are functioning well with this particular CSS, except for the issue where the div loses its size and color once the animation is completed. .fade-hide, .f ...

Utilize Jquery to dynamically update form input in real time based on checkbox selections

I am working on a form that requires real-time calculation of GST (Goods and Services Tax) directly within the form (GST = Price/11) This functionality has been implemented with the following script. Additionally, the calculation needs to be adjust ...

What is the best way to utilize justify-content or align-self to perfectly center this?

Despite my efforts to center it, I'm struggling to do so. I've experimented with justify-content and align-items for each row and col class, but unfortunately, nothing seems to be effective. In the breakpoints (md, lg), I really need the 4 lorem ...

Transforming CSS with React Router Links

Why is my CSS being significantly altered by the React Router Link? Is there a way to prevent the Link from affecting the styling? Without Link: https://i.sstatic.net/ZoVEq.jpg With Link: https://i.sstatic.net/84qRS.jpg This is the code for the ...

When utilizing jQuery's .on() method, sometimes the data being passed to the handler may appear

I have three anchor tags that are dynamically added from an ajax $.get() response. Whenever one of them is clicked, I want to trigger a second request. The parameters for the second request should be set based on the global data attributes in these an ...

Obtain data from a local JSON file using the http.get() method in Angular 2

I am attempting to utilize the http.get() method in Angular 2 to load a local JSON file. I followed a suggestion from Stack Overflow that involves modifying my app.module.ts: In this example, I have imported the HttpModule and the JsonModule from @angular ...

What is the method for inserting the document URL into a text input?

Can someone provide guidance on grabbing the top URL and inserting it into a text input field? I've tried the following method, but it's not working. Any suggestions or ideas? Additionally, is there a way to make this text input field uneditable? ...

Could not locate the CSS file within the HTML document (404)

I've searched high and low on YouTube but can't seem to find a solution to this problem. Every time I run the code, it gives me an error message saying GET net::ERR_ABORTED 404 (NOT FOUND) <html> <head> <title>itays websit ...

Unstyled Cards Failing to Receive Design

I am currently working on creating a prototype that utilizes two Bootstrap 4 cards to display information from a form and store related information from another form in the second card. The current layout of this setup can be observed below: https://i.sst ...

Occupying the entire width of a screen

Struggling to tidy up a website I'm working on for a client. I've spent countless hours trying to solve this issue! With my limited knowledge, I could really use some help with the code. The main challenge is making the top section of the site (o ...

Is your Ajax jQuery live search not functioning properly with JSON data?

My programming code is not functioning properly. Here is the file I am working on. When it does work, it does not display the list and gives an error in the Json file. I am unsure of the reason behind this issue. You will be able to view the error in the C ...

Arrange pictures and div elements in a horizontal layout

I am facing an issue with my code that is displaying 5 'cards' in a messed up layout instead of a straight line. I have tried to align them vertically, but some are still higher and not in the right positions. For reference, I want the layout to ...