What can I do to prevent my paragraph from extending down the entire page when adjusting the resolution?

I am facing an issue with my responsive website where the paragraph text appears as a long word tower when the screen size is reduced. How can I resolve this problem and reduce the space between the words? You can see the issue in the image here: https://i.sstatic.net/HYJzs.png

Here is the code snippet:

enter code here...

@import url("https://fonts.googleapis.com/css?family=Poppins:400,500,600,700&display=swap");
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: "Poppins", sans-serif;
}
nav {...} 
<!DOCTYPE html>
<html lang="en" dir="ltr">
  <head>
    <meta charset="utf-8" />
    <title>Responsive Navigation Menu</title>
    <link rel="stylesheet" href="style.css" />
    <link
      rel="stylesheet"
      href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/all.min.css"
    />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  </head>
  <body>
    <nav>...

Answer №1

By setting the width to 40% in .contenthome2, you are limiting its width to 40% for mobile view. You can adjust this width for web view using media queries to meet your requirements. Keep in mind that using margin-left:100px and margin-right:150px may work well for web view, but it might take up more space in mobile view. Consider using percentage values for better responsiveness.

I have made some modifications to the code by setting width:100% and padding:10% 15%:

@import url("https://fonts.googleapis.com/css?family=Poppins:400,500,600,700&display=swap");
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: "Poppins", sans-serif;
}
nav {
  // CSS styles for navigation menu
}
@media (max-width: 1000px) {
  // Media query styles for max-width 1000px
}
@media (max-width: 920px) {
  // Media query styles for max-width 920px
}

/*index*/

.contentHome {
  // CSS styles for .contentHome
}
.contentHome2 {
  // CSS styles for .contentHome2 with modified width and padding
}

.paragrahHome h2 {
  white-space: nowrap;
}
<!DOCTYPE html>
<!-- Created By CodingNepal -->
<html lang="en" dir="ltr">
  <head>
    <meta charset="utf-8" />
    <title>Responsive Navigation Menu</title>
    <link rel="stylesheet" href="style.css" />
    <link
      rel="stylesheet"
      href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/all.min.css"
    />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  </head>
  <body>
    <nav>
      <div class="logo">Nick's Reviews</div>
      <input type="checkbox" id="click" />
      <label for="click" class="menu-btn">
        <i class="fas fa-bars"></i>
      </label>
      <ul>
        <li><a class="active" href="../index.html">Home</a></li>
        <li><a href="/mainPages/googleForm.html">Google Form</a></li>
        <li><a href="/mainPages/myMovies.html">Movies</a></li>
        <li><a href="/mainPages/myTvShows.html">Tv-Shows</a></li>
        <li><a href="/mainPages/topMovies.html">Top Movies</a></li>
        <li><a href="/mainPages/topTvShows.html">Top Tv-Shows</a></li>
      </ul>
    </nav>
    <div class="contentHome">
      <div>Welcome To Nick's Movie And Tv-Show Reviews</div>
    </div>
    <div class="contentHome2">
      <div class="paragrahHome">
        <h2>About this website:</h2>
        <p>
          // Text content about the website
        </p>
      </div>
    </div>
  </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

Transforming a horizontal list into a vertical one

What might be causing the message list to display horizontally in the admin dashboard, but vertically on other pages? .user-list{ display:inline; } .users header, .users-list a{ display: flex; align-items: center; padding-bottom: 20px; border-bottom: 1px s ...

Unexpected behavior when trying to bind data with AngularJS through a response message

Here is the code snippet: var myApp = angular.module("gameModule", []); myApp.controller("gamecontroller", function ($scope) { $scope.message = "test"; // websocket connection. var gameHub = $.connection.socketHub; $.connection.hub.star ...

Can someone please explain how I can extract and display information from a database in separate text boxes using Angular?

Working with two textboxes named AuthorizeRep1Fname and AuthorizeRep1Lname, I am combining them in typescript before storing them as AuthorizeRep1Name in the database. Refer to the image below for the result. This process is used to register and merge the ...

What is the best way to ensure proper alignment of elements in a React application?

Currently, I am delving into learning react and antd by putting it into practice. My goal is to create a layout with a button and two input fields that have a 10px gap between them, while also displaying the titles of each field directly above them. To ach ...

Display data from additional tables within a loop

Within my database, I have organized information into 3 tables: train_information: +----------+-----------------+------------------+ | train_id | number_of_axles | number_of_bogies | +----------+-----------------+------------------+ | 1 | ...

Multiple CSS styles are being employed simultaneously to render the webpage

Currently, I am utilizing JavaScript to choose different CSS styles for various accessibility options such as black on white text and larger text. The issue I am facing arises when switching the CSS sheet, as elements from previously selected sheets are st ...

Looking to turn off animation for a WordPress theme element?

Is there a code that I can insert into the style.css file to deactivate the theme animations on my WordPress page? As users scroll down, each element either drops in or slides in. I recently purchased the WP Alchemy theme from , but the animation speed is ...

Discovering the true width of elements that have overflow hidden in IE7 using jQuery

I am dealing with a dynamic list that contains around 50 elements, but the exact number may vary. <div style="width:465px;"> <ul> <li>aaa</li> <li>aaa</li> <li>aaa</li> <li>aaa& ...

What is the best way to display a description overlay on an adjacent image when hovering over it?

Seeking assistance or guidance in the right direction. I have a desire to showcase a grid of images with hover-over functionality for additional information, similar to what can be seen here. Could someone advise if this task is manageable with pure CSS ...

Choosing multiple options in a select tag leads to an error

I am facing an issue with my array and select multiple fields. I want all the select options to be automatically selected using the array ID when the file is loaded. Here is my array: Array( [0] => 3 [1] => 5 [2] => 9 ) This is what my select ...

When using an `if` statement in CSS to determine if the value of `left` is

Is there a way to trigger an event only when the object reaches a specific percentage of its left position? I am trying to achieve this using jQuery with the .css() method. Here is what I have so far: HTML: <div id="midDiv"><img ..../></di ...

What could be causing the read-only error in my presentation?

My website has always had a small slider that worked perfectly, but now an error message keeps popping up: Error: "myIndex" is read-only This is the JavaScript code in question: const myIndex = 0; carousel(); function carousel() { let i; const x = ...

Is it possible to superimpose a post-type title onto the featured image?

I have crafted this WP_Query to extract the titles and featured images from my post types. <div class="job-cont"> <?php $query = new WP_Query( array( 'post_type' => 'jobs' ) ); if ( $query->have_posts( ...

Show text on a button press in Angular

I have set up a group of three buttons using ngFor, each button has its own unique name stored in an array called buttonData[]. The buttonData array also includes corresponding text and images for each button. My goal is to display a specific text and imag ...

Is There a Way to Verify if JqxGrid Contains Any Errors?

Within the code below, I have successfully displayed highlighted borders when there are validation failures. Is it possible to determine any validation errors in a grid when a button is clicked? By clicking the button at the bottom, I would like to be able ...

Obtaining the Author's ID on Blogger

Is there a way to extract the author's ID on Google's blogger.com platform? I'm familiar with how to obtain the post ID using data:post.id, but what about the author's ID? ...

I'm looking to add CSS transitions, like fade-ins, to a list of items in React in a way that the animations occur one after the other upon rendering. How can this be achieved?

I've scoured the depths of Stack Overflow and combed through countless pages on the internet in search of an answer to my query, but alas, I have not found a solution. So, my apologies if this question is a duplicate. Here's my conundrum: https ...

Is there a way to have the submit button show the uploaded file on the same page, without redirecting to a new

My code seems to be malfunctioning and I suspect it's due to some errors. I'm attempting to have the submit button display an image of a molecule using JSmol. Can anyone lend a hand with this? <script> var Molecule = { width: 550, ...

Are there specific mathematical algorithms that lend themselves well to creating responsive HTML designs?

Tired of constantly guessing the percentage values to use with a specific number of divs and other elements in my design. I am looking to understand the mathematical calculations that determine the scaling required for different elements in order to main ...

Utilize a component's CSS styles by inheriting them and applying them to another component

I have created custom styles for an object as shown below: form#sign_in{ position:relative; margin:85px auto 50px auto; width:455px; background:#fff; border:#dfdfdf 1px solid; border-radius:5px; -moz-border-radius:5px; -web ...