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

What is the best way to select the element where a user has clicked using JavaScript?

Referencing a previous question on Stack Overflow, the goal is to track user clicks in a Firefox browser using JavaScript. The provided JavaScript code almost achieves this: var DocElements = document.getElementsByTagName('*');for(var i = 0; i & ...

Concealing a button within a specific interface

I am currently facing an issue with a data table that includes two control buttons: edit and save. My problem lies in hiding the save button on the initial preview. Basically, what I want to achieve is displaying only the Edit button on the first page. Wh ...

The fluid table within the Bootstrap container is not adapting to different screen

Can't figure out why the bootstrap container fluid table is not responsive. Even though I used an example of My First Bootstrap Page that works fine and is responsive, this particular table remains unresponsive. I want to avoid using a scroll but will ...

HTML5 Video Frozen in Place on Screen's Edge

I am encountering a problem specifically on Webkit, particularly in web view on iOS. When I tested it on desktop Chrome, the issue did not appear. Here is the Portrait image and Here is the Landscape image The video seems to be fixed in one position rega ...

Maintaining the layout of two columns in Bootstrap 4, responsive design turns them into a single stacked

Currently using Bootstrap v4 with a two-column layout that splits the container in half. On larger screens, the items in each column display correctly. However, on smaller screens, Bootstrap shuffles the items from column 2 into column 1. I am looking to ...

Struggling with Getting My Animation to Function Correctly

I am trying to create a JQuery Animation that will move a div covering a text box up into the border when clicked. Despite multiple attempts, I can't seem to get the animation to work properly. Any suggestions? JavaScript function moveup(title,text ...

Creating custom elements for the header bar in Ionic can easily be accomplished by adding your own unique design elements to the header bar or

I'm a beginner with Ionic and I'm looking to customize the items on the header bar. It appears that the header bar is created by the framework within the ion-nav-bar element. <ion-nav-bar class="bar-positive"> <ion-nav-back-button> ...

What is the best way to customize the cursor for each individual div?

Can you alter the cursor from a pointer to "not-allowed" within the div or GridList element in ReactJS or Material UI? ...

Unique property in css without a specified value

I have a challenge in creating a custom CSS property to disable an element without using the disabled keyword. This is the code I came up with, but unfortunately, it did not achieve the desired result: <style> .admin { color: green; enable: ...

Navigating Through Siblings with Http Agility Pack

When it comes to working with the HTML Agility Pack, it's easy to extract descendants and entire tables. However, how can you utilize this tool in a unique situation like the example below? ...Html Code above... <dl> <dt>Location:</dt ...

Using `vertical-align` on a `span` inside a flexbox container may not produce the desired result

Some users are experiencing issues with the vertical-align: middle property not working on a span. .tc__timezone-toggle { display: flex; } .tc__timezone-toggle span { vertical-align: middle; } .tc__timezone-toggle-ui { display: block; font-wei ...

The speed of the Ionic app is disappointingly sluggish on devices, causing significant delays

After testing my app in Ionic Lab, it runs smoothly. However, when I create the apk file and install it on my device, the performance is very slow. There are delays in clicking on buttons, pushing pages, opening modals, and closing modals. It seems like t ...

How can I style the empty text in an ExtJS grid using CSS?

Is there a specific CSS class for a grid's emptyText? After inspecting the element with Firebug, all I found was: <div id="gridview-1021" class="x-component x-grid-view x-fit-item x-component-default x-unselectable" role="presentation" tabindex=" ...

Issue with JS jQuery: The click event on an li element within an expanded ul does not function properly

I have built a basic webpage to explore jQuery. However, there is an issue that arises when I click on the "Button: another one." It seems to interfere with the event of clicking on the li element, causing it to glitch and not respond. Here is the code: JS ...

Display an HTML image within a span tag and ensure it is aligned to the bottom

I am facing a layout issue with 2 images that are placed side by side within their tag . The sizes of the images are different, but they are both anchored at the top of their parent element. <span style="position: relative; left: 0; top: 0; vertical- ...

What are your preferred HTMLPurifier configurations for sanitizing CSS styles?

I'm currently in the process of developing an application that allows users to input their own custom CSS for their profiles, similar to platforms like MySpace, Friendster, and Blogger. However, I'm struggling to find an effective method to prot ...

Tips on setting the ajax parameter contentType to "html"

I'm encountering an issue where the variable "myvariable" is passing as null. Can anyone provide guidance on what I might be doing incorrectly? $.ajax({ type: "POST", url: "/MyController/MyAction", data: JSON.stringify({ items: my ...

Position the background of the container in the center and keep it

I am trying to create a fixed background header using the following CSS properties: header { margin: 0; padding: 0; width: 100%; height: 300px; display: block; background-image: url('...'); background-repeat: no-repea ...

Exploring jQuery Mobile | Moving Seamlessly between Pages

I'm relatively new to JQM and I'm working on creating a mobile application using jQuery Mobile. Here's the goal I'm aiming for: I have multiple HTML pages, each with its own CSS, JavaScript, and JQM components. What I want is to be ab ...

Extract information from page 1 to page 2 by utilizing ajax

Greetings, I am currently facing an issue with parsing data using the href get method to retrieve PHP by ajax on another page. Is this achievable? By the way, my framework of choice is CODEIGNITER. This is my HTML href code snippet: <a href="'.b ...