Is the text alignment off?

I've been immersed in creating a website, but I encountered an issue for which I can't seem to find the solution.

Check out my text alignment here (test) - it's not aligned all the way to the left of the content

Here is the HTML code:

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">

    <title>The HTML5</title>

    <link rel="stylesheet" href = "style.css">
    
    <style>
    </style>
</head>

<body>
    <div class="container">
        <div class="header">
            <h1>Zieke Site</h1>
        </div>
        
        <div class="topnav">
            <a href="#">Menu</a>
        </div>

        <div class="content">
            <p>Test</p><p>Test</p><p>Test</p><p>Test</p><p>Test</p><p>Test</p><p>Test</p> 
            <p>Test</p><p>Test</p><p>Test</p><p>Test</p><p>Test</p><p>Test</p><p>Test</p> 
            <p>Test</p>
            <p>Test</p><p>Test</p><p>Test</p><p>Test</p><p>Test</p><p>Test</p><p>Test</p> 
          <p>Test</p><p>Test</p><p>Test</p><p>Test</p><p>Test</p><p>Test</p><p>Test</p> 
           <p>Test</p><p>Test</p>
            <p>Test</p><p>Test</p><p>Test</p><p>Test</p><p>Test</p><p>Test</p><p>Test</p> 
        <p>Test</p><p>Test</p><p>Test</p><p>Test</p><p>Test</p><p>Test</p><p>Test</p> 
        <p>Test</p> 
        <p>Test</p>
        </div>


        <div class="footer">
            <p>Footer</p>
        </div>
</div>

</body>
</html>

This is my CSS code:

body {
margin: 0;
}

.topnav {
background-color: #333;
height: 28px;
}

.topnav a {
float: left;
color: white;
padding: 5px 15px;
text-decoration: none;
}

.topnav a:hover {
background-color: #ddd;
color: black;
}

.header {
background-color: #747474;  
text-align: center;
height: 80px;
line-height: 80px;
}

.content {
background-color: rgba(255, 255, 255, 0.9);
text-align: left;
height: Calc(100vh - 182px);
overflow: auto;
}

.footer {
background-color: #747474;
text-align: right;
padding: 1px 20px;  
}

.container {
margin: 0 auto;
width: 70%;
}

Hopefully, someone can help me figure this out. I'm still new to coding, so please bear with me if it's an easy fix 😄!

Answer â„–1

Execute the code snippet below:

Note: Ensure that the script is executed on a complete webpage!

body {
margin: 0;
}

.topnav {
background-color: #333;
height: 28px;
}

.topnav a {
float: left;
color: white;
padding: 5px 20px;
text-decoration: none;
}

.topnav a:hover {
background-color: #ddd;
color: black;
}

.header {
background-color: #747474;
text-align: center;
height: 80px;
line-height: 80px;
}

.content {
background-color: rgba(255, 255, 255, 0.9);
text-align: left;
height: calc(100vh - 182px);
overflow: auto;
padding: 0px 20px;
}

.footer {
background-color: #747474;
text-align: right;
padding: 1px 20px;
}

.container {
margin: 0 30px;
}
<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <title>The HTML5</title>
    <link rel="stylesheet" href="style.css">
    <style>

    </style>
</head>

<body>
    <div class="container">
        <div class="header">
            <h1>Cool Website</h1> </div>
        <div class="topnav"> <a href="#">Menu</a> </div>
        <div class="content">
            <p>Testing this out!</p>
            <p>Testing this out!</p>
            <p>Testing this out!</p>
            <p>Testing this out!</p>
            <p>Testing this out!</p>
            <p>Testing this out!</p>
            <p>Testing this out!</p>
            <p>Testing this out!</p>
        </div>
        <div class="footer">
            <p>Copyright Information</p>
        </div>
    </div>
</body>

</html>

Answer â„–2

Ensure that the container's width attribute is set to 100%

.container {
margin: 0 auto;
width: 100%;
}

Answer â„–3

Perhaps this could be the solution

.container {
background-color: rgba(255, 255, 255, 0.9);
text-align: right;
padding-right: 10px;
height: Calc(100vh - 182px);
overflow: auto;
}

Answer â„–4

To include this snippet of code

 <div style="clear:both"></div>

Insert it directly beneath

 <div class="topnav">
        <a href="#">Menu</a>
  </div>

This will guarantee proper functioning, as demonstrated in this test link

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

What is the best way to expand and collapse a mat-expansion-panel using a button click

Is it possible to expand a specific mat-expansion-panel by clicking an external button? I've attempted linking to the ID of the panel, but haven't had any luck... <mat-expansion-panel id="panel1"> ... </> ... <button (click)="doc ...

Remove newline character from HTML code using Python 3.2 and urllib module

After fetching HTML content as a string using urllib, I encountered difficulty in searching the string due to its HTML format. Is there any way to "unformat" the string by removing all the new lines without altering the HTML code itself? Here is the Pytho ...

What is preventing SVG textPath from displaying properly? [Empty output in devtools]

I found this interesting code snippet on Mozilla and decided to incorporate it into a Vue component. <svg viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg"> <path id="MyPath" fill="none" stroke="red" d="M10,90 Q90,90 90,45 Q90,10 ...

Is it possible to include more details in the document?

Is it possible to include additional metadata, such as a record ID, within a file without causing corruption? I am looking for ways to add extra information to files. Can anyone offer some guidance? Your help would be greatly appreciated. Thank you! ...

Change the selection so that only the initial one appears in gray

Is there a way to make the text inside a select field gray out when the first option is selected? Can this be accomplished with just CSS or does it require JS? I have attempted altering the style of the first option, but it only affects the text color in ...

Looking to tilt text at an angle inside a box? CSS can help achieve that effect!

Hey there, is it possible to achieve this with CSS or JavaScript? I require it for a Birt report. ...

The text and buttons exceed the size limits of the popup box

Currently, I am tasked with updating an old website that includes a popup box containing an iFrame and nested tables. The content within these tables consists of text and two input boxes at the bottom. Everything within the box looks fine on screen resolu ...

What steps can be taken to properly display dateTime values in a data table when working with JavaScript (VueJS) and PHP (Laravel)?

I am facing an issue where I am unable to save user inputted date-time values from a modal into a data table. Despite receiving a success message, the dateTime values are not being added to the table. My payload only displays the state and approval fields ...

Loading an empty CSS file in Node.js

Just starting out with node.js, and I could really use some help with a small css and image issue that I'm facing. I've streamlined my html and .js for clarity. Despite trying everything, the css and image just won't load. My form and server ...

Retrieving the value of a specific image using Jquery

<div id="choose"> <div class="picked"> <img src="/def/image1.png"> </div> <div> <img src="/def/image2.png"> </div> <div > <img src="/def/image3.png"> </div> </div& ...

Sending files to the server through HTML5

Could someone assist me with uploading a file after it has been selected using HTML5? Here's the code snippet for selecting the file: <input type="file" .... /> The input field above allows you to choose a file, but I also need help with uploa ...

Being required to design a distinct div for every article I am extracting from the API

In the midst of developing a website for my college project, I have successfully configured my news API to pull and display data using JavaScript. Currently, I am faced with the challenge of having to create separate div elements each time I want to add n ...

Harvesting data from an HTML document using BeautifulSoup and Python

I am currently working on extracting text from an HTML file. The HTML file has the following structure: <li class="toclevel-1 tocsection-1"> <a href="#Baden-Württemberg"><span class="tocnumber">1</span> <span class= ...

"Creating visual art with processing in 2D using P5

Recently, I came across a webpage about rendering 2D objects in processing using JavaScript. Here is the link to the page: Upon trying out the example code provided on the page in a new P5 project, I noticed that the code structure looked like this: HTML ...

Top-notch tools and guides for front-end web development

As I prepare to transition to a new role focused on front-end web development, specifically CSS and jQuery, I am seeking recommendations for valuable resources to enhance my skills in these areas. Whether it be books, websites, blogs, or any other medium, ...

The image component is missing the necessary "src" attribute even though a valid src value has been provided as a prop

I'm encountering an issue in Next.JS where a component is not recognizing the image source passed through a prop. I am providing the path of an image named "logo.jpg" from the project's public folder. The image successfully displays when used as ...

s3 key not found, The specified key does not exist. previewing file from a web link

After utilizing paperclip and s3, I successfully uploaded a word document and now I am seeking the ability to preview it directly from the database using an iframe. https://i.stack.imgur.com/ceCPu.png <iframe src="<%= agreement.document.url(:smal ...

Creating a webpage menu with CSS and HTML

Is there a way to make the background color for "Sub test1" change only when hovering over it, without affecting the background color of "Test1"? See the code at http://jsfiddle.net/r5YCU/22/ Any assistance on this issue would be greatly appreciated. Than ...

Issue with CSS: Dropdown menu is hidden behind carousel while hovering

I'm struggling with adjusting the position of my dropdown list. It keeps hiding behind the carousel (slider). When I set the position of the carousel section to absolute, it causes the navbar to become transparent and the images from the carousel show ...

Can CKEditor be integrated with Mutation Observer? If so, how can this be achieved?

Trying to detect changes in the current CKEditor content. The goal is to identify which element's content has been modified when a user writes multiple paragraphs. Not well-versed in JavaScript or jQuery, but managed to come up with this code after s ...