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's the best way to ensure that the iframe resolution adjusts dynamically to perfectly fit within its container?

iframe-screenshot Displayed in the image are two iframes, but at times I may need to display three. The aim is to ensure that all iframes are responsive within their containers. Below is my existing CSS styling: iframe { width: 100%; height: 1 ...

I recently designed a form using a combination of HTML and JavaScript in order to display different dialogues depending on the number of selections made. Unfortunately, the alert function does not seem to be functioning

The concept is to have users select options and then receive employment sector suggestions based on their selections. <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF ...

The href attributes are not being retrieving correctly

I'm currently working on extracting the URLs for each restaurant listed on this page and have developed a Python script for this purpose: import time from selenium import webdriver from selenium.webdriver.common.keys import Keys browser = webdriver ...

Imitate a keypress within a hidden web browser component using C#

Currently, I am engaged in a project that requires me to navigate a webpage and gather information about products, prices, etc. using the webbrowser object in .NET 3.5. The challenge arises because the page contains fields with an ajax suggest script, mak ...

I need to verify that the input type for time is valid, starting from today's date and extending beyond the current

<input type="date" onChange={(e)=>setDate(e.target.value)}/> <input type="time" onChange={(e)=>setTime(e.target.value)} /> If the selected date is after today and the time is after the current time, display a valida ...

Generate a JSON (Jquery) structured table matrix outlining various roles and corresponding permissions such as read, write, delete, and write special

I would like to create a table matrix that displays roles and permissions (read, write, delete, write special) using jQuery with JSON data. The table should contain checkboxes for each permission type, and the checkboxes for read, write, delete, and write ...

What is the best way to trigger ajax when the user clicks the back button to return to the previous webpage?

Check out my code snippet below: HTML Code <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> <div class="body"> <div class="dropdown_div"> <select id="q_type" class="dropdown" ...

Tips for repositioning my sidebar using CSS and HTML

I'm a beginner in CSS and HTML and I'm struggling to make my sidebar move to the side on my website. I have divided my site into three div areas: one for the 'sidebar', one for the 'main content', and one for both called &apos ...

What are the steps to overlay a button onto an image with CSS?

As a CSS newbie, I have a question that may seem silly or straightforward to some. I am struggling with placing a button over an image and need guidance on how to achieve this effect. Specifically, I want the button to appear like this blue "Kopit" button ...

Applying CSS to select a different element style within a webpage

I was thinking about the possibility of linking one style to another using events like :focus or :hover in CSS alone, without the need for JavaScript. For instance, can the class "hitArea" change the background attribute of "changeArea" when it is in foc ...

Seeking assistance with coding a beginner-level Google Chrome extension

Currently, I am working on developing a basic Google Chrome extension with 2 or 3 browser actions. I have been using Selenium IDE to capture the necessary steps in Firefox that I need for my project. However, I am unsure of how to translate these recorde ...

Having trouble with looping the CSS background using JavaScript in CodePen

Can someone help me with looping through CSS background images? Why is the background not changing in this code example: http://codepen.io/anon/pen/dGKYaJ const bg = $('.background').css('background-image'); let currentBackground = 0; ...

Unidentified event listener

I am currently facing an issue where I keep getting the error message "addEventListerner of null" even though I have added a window.onload function. The page loads fine initially but then the error reoccurs, indicating that the eventListener is null. Str ...

Decoding JavaScript content with Python

Currently, I am dissecting this specific portion of HTML <script type="text/javascript"> var spConfig = new Product.Config({"attributes":{"150":{"id":"150","code":"size_shoe","label":"Schuhgr\u00f6\u00dfe","options":[{"id":"494","label ...

The absence of an eye icon in the password field when using bootstrap 5

I'm having trouble positioning the eyeball icon to the right side of my form when using Bootstrap v5 and FontAwesome v5. Instead, the password field is being shifted further to the right compared to the username field, and the eye icon is not displayi ...

Finding and Selecting Dynamic CSS Elements with CSS Selector Techniques

Utilizing a tool called Stonly for adding tooltips, the CSS Selector is used to locate the HTML element for identifying the tooltip. Depending on the user input, a dynamic task list is generated. The challenge arises when trying to pinpoint a specific task ...

Prevent parent element from changing color when child element is clicked

Check out my HTML: .imageURL:active .image_submit_div { background-color: #ccc; } .image_submit_div:active { background-color: #e6e6e6; } <div class="image_div"> <label for="id_image" class="image_submit_div"> <h3>+ add ...

The overlay only covers a portion of the page

I'm currently working on a new webpage and have found the perfect background image. However, I would like to add an overlay to darken the image. Unfortunately, the overlay doesn't cover the entire page! Despite my attempts, I haven't been s ...

Executing code upon the completion of jquery's slideUp() function

Is there a method to trigger the execution of html() only after the completion of slideUp()? <p class="test">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent tortor elit</p> $(".test").slideUp().html(""); I attempted using ...

Explore a Wordpress HTML code

I own a WordPress website using the Photolux theme. My desire is to extract HTML elements such as titles and tags, but for some reason they are not visible. Just to clarify, I am not interested in reading the XML format. If anyone has any suggestions or ...