One section's background spilling over into the next section

Apologies in advance for the lengthy explanation. I am working on building a website similar to to enhance my coding skills. The initial section of the website turned out well, but when I added another section, the layout got messed up and did not fill the entire page as expected (view picture: https://i.sstatic.net/Z3r5v.jpg).

To fix this issue, I set the height of the first sections ID to 100%:

#header {
height: 100%;}

This resolved the problem (https://i.sstatic.net/6YNVz.jpg), but now, when I resize my browser, the second section overflows into the first one, covering the text (https://i.sstatic.net/TowAk.jpg). Any suggestions or guidance would be highly appreciated!

body {
  background: linear-gradient(rgba(0, 0, 0, 0.7), rgba(0, 0, 0, 0.7)), url('/img/roses.jpg') no-repeat center center fixed; 
  -webkit-background-size: cover;
  -moz-background-size: cover;
  -o-background-size: cover;
  background-size: cover;
  font-size: 20px;
  height: 100vh;
}

/*------------------------------------------------  HOME PAGE  ------------------------------------------------------------------*/

/*------------------------------
HEADING TEXT
-------------------------------*/
.name h1 {
  font-family: 'Muli', sans-serif;
  font-size: 500%;
  font-weight: 300;
  text-align: center;
  padding-top: 10%;
  color: #ecf0f1;
  font-family: 'Cormorant Garamond', serif;
}

.name p {
  font-family: 'Play', sans-serif;
  font-size: 130%;
  text-align: center;
  padding-top: 5%;
  color: #ecf0f1;
  font-family: 'Merriweather', serif;
  font-weight: 300;
  padding-right: 10%;
  padding-left: 10%;
}

/*------------------------------
Nav Bar
-------------------------------*/

.navigation p {
  display: inline;
  font-family: 'Play', sans-serif;
  color: #ecf0f1;
}

.navigation {
  text-align: center;
  padding-top: 15%;
}

.contents,
.contents:hover {
  text-decoration: none;
  color: #ecf0f1;
  font-family: 'Delius Unicase', cursive;
}

/*------------------------------------------------  ABOUT PAGE  ------------------------------------------------------------------*/

/*------------------------------
About Heading
-------------------------------*/

#about {
  background-color: black;
  background-size: cover;
  height: 100%;

}

#header {
  height: 100%;
}
<section id="header">  <!-------------------------  HOME PAGE  -------------------------->


  <div class="container">
    <div class="row">
      <div class="col-xs-12 name">
        <h1>Temple Naylor</h1>
      </div>
    </div>

    <div class="row">
      <div class="col-xs-12 name">
        <p>I create Web-designs with a sense of Feng-Shui in mind; resulting for a intuitive, responsive, harmonious, experience for users across the world.</p>
      </div>
    </div>

    <div class="row">
      <div class="col-xs-12 navigation hidden-sm-down">
        <p><a class="contents" href="#">ABOUT</a> / </p>
        <p><a class="contents" href="#">WORK</a> / </p>
        <p><a class="contents" href="#">CONTACT</a> / </p>
        <p><a class="contents" href="#">PHOTOGRAPHY</a></p>

      </div>
    </div>
  </div>

</section>


<section id="about">  <!-------------------------  ABOUT PAGE  -------------------------->


  <div class="container">
    <div class="row about">
      <div class="col-md-6">
        <p class="big-text"></p>
      </div>
    </div>

    <div class="row">
      <div class="col-md-6 about-text">
        <p >Yup</p>
      </div>
    </div>
  </div>
</section> 

Answer №1

If you want to make an element take up the full height of the viewport, you can utilize the css vh property.

#header {
    height: 100vh;
}

To learn more about different css units, check out this link: css units. Hopefully, this information proves useful to you.

Answer №2

Adjust the height of #header to min-height:

#header { 
    min-height: 100%; 
}

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

Best practices for displaying JSON in an HTML document

Struggling with implementing jQuery autocomplete in a form with a long list of names in a dropdown select tag. The current code is not functioning as expected. public function executeNew($r) { $this->getResponse()->setContentType('applicat ...

Hide overflow for images with unique shapes

Here are the two image layers: https://i.sstatic.net/lUUQC.jpg One shows a hand holding a phone, and the other is a black hole. This is how you can achieve it using HTML markup: <div class="wrapper"> <img class="wrapper__image" src="path/to/ ...

Stop the removal of the CSS content property

When a user enters and re-enters their password, I have a form that checks the strength of the password and displays text accordingly. However, I noticed that if a user makes a mistake and uses the backspace to re-enter the password, the text from data-tex ...

Tips for refreshing the page without losing the values of variables

In my simulation.jsp file, I have the following code that retrieves simulation data from a struts2 action: $(document).ready(function() { var data='<s:property escape="false" value="simInfos" />'; } Once I perform the simulation with this ...

The XPath provided by Chrome DevTools could not be located

While delving into XPath SVG paths in the process of responding to another inquiry related to Selenium, I stumbled upon an interesting quirk with XPath specifically on Chrome (I didn't test it on other browsers). Why does this XPath not work on ? // ...

How to Stop Fixed Elements in iOS from Zooming

I'm currently working on a responsive website with a fixed header and navigation. Is there a way to allow users to zoom in on the page's content without affecting the fixed elements? Thanks for any help! ...

What is the process for altering the color of an HTML output depending on its values?

I created a simple HTML code to showcase some outcomes. The possible results are SUCCESS, Failure, and Still Failing. I want these results to be displayed with corresponding colors, such as green for SUCCESS, and red for both Failure and Still Failing. I ...

Guide on building a 2 x 2 grid layout with NativeScript's GridLayout

The Challenge I'm having trouble arranging images in a grid format with 2 rows and 2 columns, centering them evenly. Despite my efforts to experiment with different layouts, I've encountered some setbacks as shown below: https://i.sstatic.net/ ...

Problem with styling in IE and Firefox when using :active and :hover states

Encountering difficulties with a CSS-triggered overlay has left me frustrated. While the solution seems to be functioning adequately in Chrome, it is exhibiting minor issues in Firefox and proving completely nonfunctional in Internet Explorer. In Firefox, ...

Not all records are compatible with PHP Echo when placed within a paragraph

Looking for some assistance with a simple form set up; <div class="formholder"> <form action="column1.php" method="post"> <input type="text" placeholder="URL:" name="url" required=""><br> <input type="t ...

The Iframe is preventing the mousemove event from taking place

After attaching an event to the body, a transparent iframe mysteriously appeared in the background of the popup. I am attempting to trigger a mousemove event on the body in order for the popup to disappear immediately when the mouse moves over the iframe ...

Obtain the final segment using PHP from a web address

My URL is: http://domain/fotografo/admin/gallery_bg.php and I am trying to extract only the last part of the URL: gallery_bg.php However, I am looking for a dynamic solution, where the last part of the URL is obtained for each page I visit. ...

Try this CSS hack: Display images in a row instead of stacking them vertically

Is there a clever trick or hack to make images load from left to right instead of top to bottom? Any ideas on how to achieve this? I've been thinking about rotating images 90° and then using CSS transformations to bring them back to normal while m ...

Creating a dynamic linear gradient background color using Angular 2 binding

Using static values works perfectly <div style="background: linear-gradient(to right, #0000FF 0%, #0000FF 50%, #FFA500 50%, #FFA500 100%);"></div> in my TypeScript file. this.blueColor = '#0000FF'; this.orangColor = '#FFA500&a ...

Preserve the visibility of a text input form while the checkbox is selected

Within my HTML code, there is a form that includes a checkbox labeled "other." When this checkbox is selected, a textbox will appear. If the user types in text and submits the form, the textbox disappears, but the checkbox remains checked (as saved in loca ...

What is the best way to create a scrollable table that extends to 100% of the available width within its container, without taking up the

In the application, there is a collapsed sidebar on the left labeled "sidebar-left" and a container on the right with various types of content labeled "content." The issue arises with the width of this container, as it needs to take up 100% of the remainin ...

What is the method for altering the date format of a published article?

I am looking to modify the date format of a published post in WordPress. Currently, the date format is <?php the_time('m.d.y'); ?></div>, which appears as "1.20.2018". My goal is to change it to "January 20, 2018". Can anyone guide ...

The function is not defined... HOWEVER... it functions perfectly in a separate demo file

I have been attempting to implement a similar effect found here: . It's a responsive popup that can display content on demand. Initially, I have jquery 2.0.2 and jquery-ui included in my <head> section, which are loading successfully. Then ...

Consolidate radio group in Vuetify platform

I'm having trouble centering the v-radio-group. Here's my current setup: <v-container grid-list-md text-xs-center> <v-form ref="form"> <div v-if="question.question_type == 'YESNO' "> <v-radio-group ...

Searching a HTML document using Python as if it were plain text: Techniques and methods

Currently, I am in the process of developing a program that can scan a website to search for specific code snippets contained within a large file. To accomplish this task, I must extract the HTML source from each page and convert it into an HTML object usi ...