Adjust the position of the header division based on the content division

Looking to revamp my website design. I have two main divs - "header" and "content". The goal is to set the width property to 80% and center both of them. However, I'm facing some challenges with achieving this setup. Additionally, I need assistance with designing the header div to include an uploaded image. How can I achieve all these tasks successfully?

My CSS:


    #main
    {
        margin:0px auto;
        margin-left:50px;
        margin-right:50px;
        margin-top:25px;
        margin-bottom:25px;
        height:auto;
        text-align:center;}

    #content
    {

        width:80%;
        height:auto;
        margin:0px auto;
    }

    #header
    {

        width:80%;
        height:100px;
        top:20px;
    }

    #header_left
    {

        float:left ;
        height: 100px;
        text-align: center;
    }

    #header_right
    {
        margin:0px auto;
        height:30px;
        text-align:center;
        margin-top:35px;
    }

    #header_social
    {

        float:right;
        height:30px;
        text-align:center;
        margin-top:35px;
    }

Client code:

<div id="main">

    <div id="content">

    <div id="header">

    <div id="header_left">
    <asp:Image ID="Image1" runat="server" />
    </div>

    <div id="header_right">

    <asp:LinkButton ID="LinkButton5" runat="server" ForeColor="Gray"></asp:LinkButton> |
    <asp:LinkButton ID="LinkButton4" runat="server" ForeColor="Gray" ></asp:LinkButton> |
    <asp:LinkButton ID="LinkButton3" runat="server" ForeColor="#FF3300" ></asp:LinkButton> |
    <asp:LinkButton ID="LinkButton2" runat="server" ForeColor="Gray" ></asp:LinkButton> |
    <asp:LinkButton ID="LinkButton1" runat="server" ForeColor="Gray" ></asp:LinkButton>
    </div>

    <div id="header_social">
        <asp:ImageButton ID="ImageButton1" runat="server"/>
        <asp:ImageButton ID="ImageButton2" runat="server"/>
    </div>

    </div>

     // CONTENT FIELD //

    </div>

    </div>

Answer №1

Take a look at this demo on JSFiddle: http://jsfiddle.net/2wqe8/28/

I'm having trouble understanding the image upload section. Can you provide more detailed instructions?

UPDATE:
Here's another JSFiddle with more content: http://jsfiddle.net/MkP4D/8/

Remember to float the right element first when using float. For additional information: CSS Float

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

Instructions for implementing this script in HTML and JavaScript: utilize the clone() function

I came across this code snippet here function displaytickets(){ var $panel = $('<div/>').addClass('col-xs-3 panel panel-default') $panel.append($('<div><h3 class="panel-title">Title</h3></div>&a ...

The height of the li element is not properly aligning with the height of

I am having some trouble with creating a menu panel. I have set the height for both the li and menu div to be the same, but there appears to be a margin at the bottom of the li. I would like the li to completely fill the menu height. Any help is greatly a ...

"Trouble with image height not scaling correctly in Internet Explorer when using the img tag

I am facing an issue that can be observed by visiting this link using Internet Explorer. Interestingly, everything functions perfectly in all other browsers (although Chrome displays little blue squares next to the images for some unknown reason). Here i ...

Instructions on transmitting a string through a Stream

I need help with transferring additional data using a Stream example. I want to pass a string called 'infoAsString.' string infoAsString = "blablabla"; HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url); byte[] request ...

Creating an email-friendly button in Outlook without using images by styling a hyperlink with padding

Presenting a basic HTML code snippet - https://jsfiddle.net/mark69_fnd/6g0L0jwc/ <body style="background-color: white; font: normal 14px Verdana"> Hello <p></p> <a style=" font: bold 11px; text-decoration: none; background-color ...

Is there a way to blend together two elements within a Bigcommerce theme seamlessly?

Recently, I have been tasked with customizing a Bigcommerce theme for a client. While I am not very experienced with Bigcommerce and only have basic knowledge of php, I have encountered an interesting challenge with the current theme header setup. The exis ...

Dynamic loading can be followed by compiling the less file

For each component on my website, I have a separate LESS file where I import the necessary styles and controls. My goal is to compile the LESS file after it has been loaded. Here is an example of how the HTML code looks: <link rel="stylesheet/less ...

How can I retrieve a list of downloads utilizing the Chrome.downloads api?

I have developed an extension that needs to display all the downloads from the user's downloads folder on a webpage instead of opening the download folder directly. Below is the code I have implemented: window.onload = function(){ var maxNumOfEn ...

What are some methods to achieve consistent alignment of input fields across different mobile devices using CSS?

I have been working on a login page that looks good on desktop and laptop devices. However, I am facing an issue with its display on mobile devices. The design appears differently on various mobile devices - for instance, it looks acceptable on an iPhone 1 ...

Logo remains in place when scrolling halfway down the page

I have a logo that I want to stay halfway up the home page when scrolling, as if fixed in place until it reaches the footer. body { background-color: #fff; margin: 0; } nav { position: sticky; top: 0; width: 300px; height: 80px; margin:4 ...

Put a hold on non-animatable CSS attributes

I am facing an issue with an animation that extends beyond the body, while the situations before and after the animation may or may not do so. I considered applying overflow:hidden; to the body element (which is set to match the viewport height), but if th ...

Tumblr post not automatically playing flash content

I am facing an issue with embedding a flash object on my tumblr blog (Billy's audio player) where I have to click a white play button for the object to work properly. This problem seems to occur specifically in Chrome and Edge browsers, as other websi ...

Instructions for transferring files directly from one website to another

Looking at the PHP code snippet provided: <?php $image_cdn = "http://ddragon.leagueoflegends.com/cdn/4.2.6/img/champion/"; $championsJson = "http://ddragon.leagueoflegends.com/cdn/4.2.6/data/en_GB/champion.json"; $ch = curl_init();` $timeout = 0; cur ...

What is the reason for JavaScript consistently returning the initial value as the result?

My current issue involves customizing Joomla article content using a module. I am attempting to hide a div until a user clicks on an input, such as a radio button labeled Test1. Once Test1 is selected, another hidden field within the div should display the ...

The error message "Error: 'Server.Transfer + Jquery $ is undefined'" appeared on the screen

When I utilize the following code, my JSON method functions correctly: Response.Redirect("~/Default.aspx"); However, when I use Server.Transfer(string.Format("~/Default.aspx"); I encounter an error stating that '$ is undefined' It is importa ...

Center-aligned footer with a sleek right border in Bootstrap 4.1.1

Presenting my design concept for the footer: https://i.sstatic.net/kxdXJ.png Here is the code snippet for the footer design utilizing Bootstrap 4.1.1: .mainfooter-area { background: #404044; padding: 100px 0; } ... <link href="https://cdnjs.cl ...

How can I rearrange divs using CSS? Can I add parent 1 in between the children of parent 2

Check out my current HTML code structure: <div class="container> <div class="parent1"></div> <div class="parent2"> <div class="child1"></div> <div class="child2"></div> </div ...

Tips for maintaining position when refreshing a web page within a scrolling table

Recently, I came across a helpful tutorial on how to create a table with a fixed header and scrollable body. You can find it here. While the tutorial worked perfectly for me, I encountered an issue when trying to refresh the webpage and maintain my positio ...

Creating an in-memory HTTP cookie in C#: A Step-by-Step Guide

I am facing an issue where my cookie keeps reappearing even after the user closes their browser. I have tried setting HttpOnly and Secure properties, but it doesn't seem to work as expected. HttpCookie cookie = new HttpCookie("mycookie", "abc"); cook ...

Implementing a horizontal card layout using a for loop in a Flask application

Currently, I have implemented a for loop to showcase a list of cars in a card layout. However, upon integrating the jinja template, the cards now appear vertically instead of horizontally. Below is the HTML code snippet: {% for car in cars %} < ...