What is the best way to create a footer in this scenario and is there a method to perfectly center an

What is the best way to position the footer at the bottom of the page without overlapping the top content?

Is there a method to center both the height and width of the header element on the page?

Can you review the layout of this webpage and provide feedback on its structure?

html { width:100%; height:100%; margin:0; padding:0; }
body { width:100%; height:100%; margin:0; padding:0; }

body {
    font-family: Garamond;
}
header {
    background-color: #3CB371;
    width: auto;
    height: 150px;
    color: white;
    font-size: 130%;
    text-align: center;
    padding: 10px;
}
section {
    position: absolute;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
}

.left {
    background-color: #FAEBD7;
    position: absolute;
    left: 0px;
    width: 55%;
    height: 450px;
}

.right {
    background-color: #FAEBD7;
    position: absolute;
    right: 0px;
    width: 45%;
    height: 450px;
}
img {
    padding: 3px;
    margin: 15px;
    border: dotted;
    border-radius: 2px;
    border-color: #3CB371;
}
footer {
    background-color: red;
position: absolute;
}
<!DOCTYPE HTML>

<html lang="en">

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

<body>
    <header>
        <h2>Some H2<h2>
    </header>
    <section>
        <article>
            <div class="right">
                <h3>Some H3</h3>
                <ol>
                    <li value="5">Some5 LI</li>
                    <li value="9">Some9 LI</li>
                    <li value="20">Some20 LI</li>
                    <ol>
                        <a href="url1" target="_blank" rel="noopener">
                            <li>Some href1 text</li>
                            <a href="url" target="_blank" rel="noopener">
                                <li>Some href2 text</li>
                    </ol>
                </ol>
            </div>
            <div class="left">
                <img src="imgurl" alt="Image" class="center">
            </div>
        </article>
</section>
<footer>
Some footer text
</footer>

</body>
</html>

Thank you for your assistance!

Answer №1

Initially, it's important to ensure proper closing of tags such as <a> and <h2>. Pay attention to avoiding mistakes in this area.

Additionally, remember to apply bottom:0; to your footer to prevent any odd placement due to the use of position:absolute;.

Lastly, consider using float:right; instead of setting position:absolute; with right:0; for the .right div.

Answer №2

<!DOCTYPE HTML>

<html lang="en">

<head>
    <meta charset="utf-8">
    <title>Title</title>
    
    <style>
*{
    padding:0;
    margin:0;
    box-sizing:border-box;
}    
body {
    min-height:600px;
    width:100%;
    font-family: Garamond;
    background-color: #3CB371;
}
header {
    width: 100%;
    height: 150px;
    color: white;
    font-size: 130%;
    text-align: center;
    padding: 10px;
    border-bottom:1px solid black;
    line-height:150px
}

section {
    min-height:450px;
    border-top: 1px solid black;
    display: flex;
}

.left {
    flex-basis: 55%;
}

.right {
    border-right:1px solid;
    flex-basis: 45%;
    overflow-y: auto;
}
img {
    padding: 3px;
    margin: 15px;
    border: dotted;
    border-radius: 2px;
    border-color: #3CB371;
}
footer {
    footer:100px;
    height:100px;
    border:1px solid black
}
ol{
    text-align:center
}
    </style>
</head>

<body>
    <header>
        <h2>Some H2</h2>
    </header>
    <section>
        <article>
            <div class="right">
                <h3>Some H3</h3>
                <ol>
                    <li value="5">Some5 LI</li>
                    <li value="9">Some9 LI</li>
                    <li value="20">Some20 LI</li>
                    <ol>
                        <li><a href="url" target="_blank" rel="noopener">Some href1 text</a></li>
                        <li><a href="url" target="_blank" rel="noopener">
                            Some href2 text</a></li>
                    </ol>
                </ol>
            </div>
            <div class="left">
                <img src="imgurl" alt="Image" class="center">
            </div>
            <div style="clear:both"></div>
        </article>
</section>
<footer>
Some footer text with a new border
</footer>

</body>
</html>

i have made some changes in your code and have also added border so it would help you understand easily

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

Override current website to display the mobile version

Few limitations to consider. Dealing with Sharepoint 2013, which can cause some issues from time to time. Hopefully won't affect the outcome. Unable to modify the viewport meta tag for the site. The website is a preexisting large site that was ...

Using jQuery AJAX to preload GIF images for CSS background-image loading

For some time, I have been utilizing jQuery AJAX to preload GIF images with the following code: $("#images").html("<img id='loader' src='../img/ajax-loader.gif' />"); Now, I am attempting to achieve a similar effect (such as a s ...

Creating a text container in PHP for displaying information

As someone who is new to PHP and HTML, I'm curious about the CSS statements needed to create a text box that will display a value from one of my PHP functions. Right now, the function retrieves data from an SQL server and returns it, but I would like ...

What could be causing the span class data to not be retrieved by the getText method

Looking to retrieve the value of a span class called 'spacer-right big project-card-measure-secondary-info' <span class="spacer-right big project-card-measure-secondary-info">1</span> snippet of code: browser.waitForEl ...

What is the best way to set the tab as "active" in the first iteration of a PHP while loop?

When using a while loop to populate tabs with PHP, maintaining only one active tab at a time can be tricky. I have grasped that assigning the 'active' class within the loop causes all tabs to become active. So, how should I modify the script if I ...

Limit access to a specific route within the URL

Is there a way to ensure that users can access and download myfile.pdf without being able to see or access /root, /folder, or /subdirectory in the URL? This functionality can be implemented using HTML, Angular 6, ReactJS, or similar frameworks. ...

Revolutionize iPad user experience with seamless HTML5 video integration

What is the most effective method for dynamically embedding HTML5 video to ensure compatibility with the iPad? (using pure Javascript) I'm having difficulty getting this approach to work: <div id="placeholder"><script type="text/javascript" ...

Is there a way to retrieve all "a" tags with an "href" attribute that contains the term "youtube"?

My goal is to capture all a tags that have the href attribute containing the word youtube. This task requires the use of jquery. ...

How can a JSON string be assigned to a variable for use in a Google pie chart?

I am currently experiencing an issue with my web server. I am sending a JSON object as an argument via render_template to my website, where I intend to use this data to display a Google pie chart. The problem arises when I try to assign the Google pie cha ...

Desktop media queries are functioning properly, yet experiencing issues on mobile devices

I've come across this same question multiple times, but the solutions I've found so far haven't been helpful. My media queries are working perfectly on desktop, but they don't seem to take effect on three different android devices. It&a ...

"Top navigation element and anchors now have a permanent fix in place

Having some trouble with the CSS here - anchor links are getting hidden behind the navigation bar. Any ideas on how to fix this? Do you have a suggestion for making sure the anchor link text is visible just below the navigation bar? /* adjust the style a ...

Enable content to be displayed when hovering over it with a mouse in

As a newcomer to JavaScript, I am eager to learn how to add an interactive feature to my menu item. I want to create an info box that pops up when the menu item is clicked, and can also be displayed when hovering over it. Below is the script I have so far, ...

I'm puzzled as to why my media query for `max-width: 470px` isn't functioning correctly

I'm struggling to get my code to work properly. I've tried adjusting some parts to be more specific and others more general, but it's not functioning as expected. Please review my code and any advice or assistance would be greatly appreciat ...

When the progress bar is clicked, the background color changes and then changes back again

https://www.w3schools.com/code/tryit.asp?filename=FG1ZE0NJ4ZX7 https://i.stack.imgur.com/Bnd0k.png I have created a progress bar that resembles the screenshot provided. When I hover over it, the color changes to green. However, I am looking for assistanc ...

How can I style the options and optgroups of a select dropdown with CSS, focusing on padding and margins?

In my experience, I have found that padding or margin CSS properties only seem to affect the appearance of options within the select menu in Firefox browser. I attempted the same styling in Internet Explorer and Chrome but it did not have any effect. Is ...

Error: Unrecognized HTML, CSS, or JavaScript code detected in template

I'm currently utilizing the "Custom HTML Tag" option in GTM with my code below, but encountering an error when attempting to publish: Invalid HTML, CSS, or JavaScript found in template. It seems that GTM may not support or recognize certain tag attri ...

Failure to Present Outcome on Screen

Seeking assistance! I attempted to create a mini loan eligibility web app using JavaScript, but encountered an issue where the displayed result did not match the expected outcome upon clicking the eligibility button. Here is the HTML and JavaScript Code I ...

jQuery - Modify Turn.js to exclusively implement the page Peel effect

I am attempting to implement the peel effect from turn.js into my code, where hovering over the bottom right corner of the page causes it to peel slightly and appear as if it is bending upwards. I specifically want only the peel effect and not the entire ...

Drop-down menu for every individual cell within the tabular data

I'm working with a large HTML table that looks like this: <table> <tr> <td>value1</td> <td>value2</td> </tr> <tr> <td>value3</td> <td>value4 ...

Convert form data into a JSON object utilizing JQuery and taking into account nested JSON objects

Currently, I am facing an issue while extracting data for submission using the jQuery `serializeArray()` function. This function works efficiently by providing an array of { name: value } objects, where the name corresponds to the elements in the form. How ...