When the browser is resized, various div elements clash with each other

Whenever the browser is resized, the div elements end up overlapping each other.

To view the HTML file mentioned in this post, you can visit the following URL: http://codepen.io/SanjeetSk/pen/ZQBBaz

I'm seeking a genuine solution directly related to the issue at hand, rather than recommending solutions like min-width and overflow hidden. That's why I've included the link to the codepen in this post. Once again, here's the link for your reference: http://codepen.io/SanjeetSk/pen/ZQBBaz

.home-area, .work-area, .contact-area {
padding: 80px 20px 80px 20px;
position: relative;
height: 100vh;
/* overflow: hidden; */
}

.navbar-toggle{
  width: 42px;
  height: 38px;
  float: right;
  margin-top: 10px;
}

.navbar-toggle * {
-ms-transition: all 0.5s ease;
  -webkit-transition: all 0.5s ease;
-moz-transition: all 0.5s ease;
-o-transition: all 0.5s ease;
transition: all 0.5s ease;
}

.navbar-toggle span {
width: 20px;
height: 2px;
margin-bottom: 3px;
background-color: green;
display: block;
}

<!-- Codepen styling, not required for use -->
.navbar-toggle span.bar1 {
-ms-transform: rotate(45deg);
-webkit-transform: rotate(45deg);
  -moz-transform: rotate(45deg);
  -o-transform: rotate(45deg);
  transform: rotate(45deg);
-ms-transform-origin: 1px 3px;
-webkit-transform-origin: 1px 3px;
  -moz-transform-origin: 1px 3px;
  -o-transform-origin: 1px 3px;
transform-origin: 1px 3px;
width: 24px;
} 
.navbar-toggle span.bar2 {
  -ms-transform: rotate(-360deg) scale(0);
  -webkit-transform: rotate(-360deg) scale(0);
  -moz-transform: rotate(-360deg) scale(0);
  -o-transform: rotate(-360deg) scale(0);
  transform: rotate(-360deg) scale(0);
}
.navbar-toggle span.bar3 {
  -ms-transform: rotate(360deg) scale(0);
  -webkit-transform: rotate(360deg) scale(0);
  -moz-transform: rotate(360deg) scale(0);
  -o-transform: rotate(360deg) scale(0);
  transform: rotate(360deg) scale(0);
} 
.navbar-toggle span.bar4 {
-ms-transform: rotate(-45deg);
-webkit-transform: rotate(-45deg);
transform: rotate(-45deg);
-ms-transform-origin: 2px 0px;
-webkit-transform-origin: 2px 0px;
transform-origin: 2px 0px;
width: 24px;
}
.navbar-toggle.collapsed span.bar1,
.navbar-toggle.collapsed span.bar2,
.navbar-toggle.collapsed span.bar3,
.navbar-toggle.collapsed span.bar4 {
-ms-transform: none;
-webkit-transform: none;
transform: none;
width: 20px;
}
.footer{
height: 50px;
background-color: #ffc04c;
}
.copyright{
   padding-top: 10px 
}
<html lang="en">
<html>

<head>
  <!-- Designed and Developed by DigitalSrishti inc -->
  <!--  DigitalSrishti :- Your Digital partner for sustainable future -->
  <title>My Portfolio</title>
</head>

<body data-spy="scroll" data-target="#navbar">
  <div class="navbar navbar-default navbar-fixed-top bs-dos-nav " role="navigation">
    <div class="container">
      <div class="navbar-header">
        <div class="navbar-toggle collapsed target" data-toggle="collapse" data-target="#navbar" id="rotate">
          <span class="bar1"></span>
          <span class="bar2"></span>
          <span class="bar3"></span>
          <span class="bar4"></span>
        </div>
        <a href="#" class="navbar-brand">Your Logo</a>
      </div>
      <nav id="navbar" class="collapse navbar-collapse">
        <ul class="nav navbar-nav navbar-right main-navigation text-uppercase ">
          <li><a href="#home">Home</a></li>
          <li><a href="#work">Work</a></li>
          <li><a href="#contact">Contact</a></li>
          <li><a href="#resume">Resume</a></li>
          <li class="disabled"><a href="#social">Social</a></li>
        </ul>
      </nav>
    </div>
  </div>
  <!-- <a href = "_http://themes.getbootstrap.com/products/application"> click here I liked the friends and enemy :-) profile</a> -->
  <!-- Start Home -->
  <div id="home">
    <div class="home-area">
      <div class="container">
        <h1><strong>Sanjeet Shukla</strong></h1>
        <p>Have a look at some <strong>Works</strong> I have done so far, it <strong>BI Designer</strong> creating modern and responsive reports for <strong>Web</strong> and <strong>Mobile</strong>. You can view my<strong>Profile</strong> and <strong>resume</strong>          and also find a link to become my friend or enemy on social sites, it is cool.. right?</br> Let us work together. Thank you.</p>
        <a href="#work" class="btn btn-default">Let's Begin</a>
      </div>
    </div>
  </div>
  <!-- End Home -->

  <!-- Start Work -->
  <div id="work">
    <div class="work-area">
      <div class="container">
        <h1>My <strong>Work</strong></h1> Have a look at some of my <strong>Works</strong> It may help you choose best partner for your work ;-)
        <diV class="row">
          <div class="col-md-3">
            <h4>Mobile Dict</h4>
            <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor.</p>
          </div>
          <div class="col-md-3">
            <h4>HTML Template</h4>
            <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor. </p>
          </div>
          <div class="col-md-3">
            <h4>tic-toe Game</h4>
            <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor.</p>
          </div>
          <div class="col-md-3">
            <h4>Pathshala(ERP)</h4>
            <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor.</p>
          </div>
        </div>
      </div>
    </div>
  </div>
  <!-- End Work -->

  <!-- Start Contact -->
  <div id="contact">
    <div class="contact-area">
      <div class="container">
        <h1>Contact <strong>Me</strong></h1>
      </div>
    </div>
  </div>
  <!--End Contact-->

  <div class="footer navbar-fixed-bottom" id="footer" align="center">
    
  <div class="copyright p">© 2016 <a href="www.sanjeetshukla.me">Sanjeet Shukla</a></div>
  </div>
</body>
</html>

Answer №1

When you set the height of -area divs to 100% of the browser window, the text starts overflowing if the container size is not enough when the browser is resized:

.home-area, .work-area, .contact-area {
...
height: 100vh;
...
}

To prevent the text from overflowing, consider using min-height: 100vh so that the container can expand beyond its initial height.

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

Replacing the CSS Reset with the Universal Selector

I implemented Eric Meyer's Reset to set the font, and then loaded my stylesheet to globally set the font using the universal selector. Even though I loaded the universal selector in my SASS after the reset, the reset is still taking precedence. (Atta ...

Use the resizable function for widths greater than 1024px

I have a resizable function on my page: $(function() { $( "#droppable" ).droppable({ create: function( event, ui ) {$( this ).hide(0)} }); $( "#droppable" ).on( "dropover", function( event, ui ) { $( this ) $( this ).text('¿Eliminar?&apo ...

Extracting graph coordinates from a webpage using web scraping

Looking for assistance with web scraping to extract player rankings from a graph displayed in this link Simply visit the link, click on Rating, and hover over the plotted points. The y-coordinate will be visible along with other relevant information that ...

Adjusting the size of <nav> element to accommodate its child elements

I've exhausted all possible CSS solutions today in an attempt to make my parent nav tag home-main-nav-menu resize based on its children and grandchildren, but it just won't cooperate. If anyone could provide a clear explanation on how to solve th ...

Obtain the HTML5 data attribute from an event directly in the code

I am attempting to access the data attribute in the following manner (my doctype is html5): <a href="#my-link" data-zoom="15" onclick="alert(this.data-zoom); return false;">link</a> However, I am encountering an e ...

What is the best 'event' to pair with an <input/> element in iOS/Android development?

Looking for a way to toggle results when a user starts typing in a search field? Here are some event options: mousedown / mouseup touchstart / touchend focus You could also consider using the "change" event instead of "click" to check for text input an ...

Unable to successfully Uploading an Image using PHP

I've encountered a new issue. I'm trying to upload an image from my webpage into a folder on the server (using XAMPP). Despite trying multiple examples, including those from php.net and w3schools.com, the code isn't working and I can't ...

Generating Hyperlinks in a Web Page Using ActionScript 3

I created a custom Wiki program that functions locally, effectively organizing articles and inserting HTML links to link to further functionalities (which load subsequent articles). Here's a snippet of the code to give you a better understanding: fo ...

Tips for implementing a fully responsive left-side menu using Twitter Bootstrap 4.2

I'm attempting to design a layout featuring a top navbar and a collapsible left menu. On medium-sized screens or smaller, the left menu should remain hidden. However, it needs to occupy the full height of the page at all times, regardless of its actu ...

What is the method for adjusting the width of a Bootstrap 4 toast message?

I have a webpage featuring a Bootstrap 4 toast with the position set as position: fixed. The entire code snippet for the toast section is shown below: <div class="container mt-5"> <button type="button" class="btn btn-pri ...

Generate a hyperlink that launches the correct mapping application on all devices, providing directions to the desired destination

It seems that finding an excellent cross-device article is harder than anticipated. I have been trying to create a link that will either open the mobile device's browser and navigate to Google Maps or directly launch a maps app (Apple Maps or Google M ...

Shifting elements within a modal using AngularJS and CSS: Swapping one div out for another

I am currently developing an application and I am considering using AngularJs for this purpose: <div class="main"> <div class="one">Content 1 goes here ...</div> <div class="two">Content 2 goes here ...</div> </div> Wi ...

Are you looking for methods to alter the elements of a webpage prior to viewing it?

I have created a page with the intention of using it as a tool, but I am facing some challenges due to my limited experience in this field. As a newcomer, I am struggling to achieve certain goals: - My objective is to modify the values of an element on a p ...

"Uncovering the parent element with jQuery: A step-by-step guide

I need help increasing the font size of a parent element without affecting the entire body's font size. How can I achieve this? For example, with the id="vs-1", I want to increase the font size of the grandparent li text here which is "1940". $("li ...

Unknown error detected in Ajax URL connection

<html> <head> <meta charset="utf-8"/> <script src="../JQUERY/jquery-1.11.0.js"></script> <script> function fetchMenuOptions() { var html = ""; $.ajax( { //url: 'http://server.com/?method=get&a ...

Expand the <canvas> element to completely fill the flex item without any scrollbars

I am currently utilizing Bootstrap 5 and experimenting with setting up a nested flex layout that occupies the entire window. One of the flex items should be filled by a "stretchy" canvas element, ensuring there are no scrollbars present. However, when I a ...

The medium breakpoint is utilized in Bootstrap 4 for printing purposes

Recently, I made updates to some pages to enhance their mobile friendliness. However, we encountered an issue where some users are printing the pages using tablet styles instead of desktop styles, regardless of whether they are in portrait or landscape mod ...

Adjust the size of a component dynamically to match another

In this scenario, we are dealing with two columns labeled A and B. Typically, column A contains more content, resulting in a greater height of 126px, while column B has less content, leading to a shorter height of 94px. The challenge arises when the h ...

Unable to discover a method to accomplish this task

Greetings to the Stack Overflow community! I have a scenario with two div blocks containing images of dimensions 1280px width and 700px height each. In the first block, there is a div with a width of 400px and a height of 100% floating left. The second ...

Converting an NPM package into a gulp workflow

I'm currently generating html files from Nunjucks using my gulp file. Now, I need to convert these html files into text files. I came across a useful NPM package called html-to-text that can help with this task. However, I'm facing some challenge ...