Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5974701
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T20:58:45+00:00 2026-05-22T20:58:45+00:00

I styled an image with float:left, and predictably, the text of the header after

  • 0

I styled an image with float:left, and predictably, the text of the header after it appears to the right of the image (if it helps, the context for this situation is a logo and title next to each other in the header of a website).

When I look at the header element (h1), it takes up space behind the image (overlapping). The text is still next to the image, but the background of the h1 element overlaps with the image.

<div id="header">
  <a href="index.html"><img src="logo2.png" /></a>
  <h1>AlanHoRizon</h1>
  <p>
...
#header img {
    float: left;
}

Is this how floating is supposed to work? Is background synonymous to the padding in the css box model? What if I wanted the header element to begin completely after the image, including the background (which is what I expected float to do actually).

Doesn’t actually affect the appearance of the header, as everything appears as it should, but I’m curious, as it would add to my understanding of html and css web design.

thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T20:58:45+00:00Added an answer on May 22, 2026 at 8:58 pm

    HTML:

    <div id="header">
        <a href=""><img id="logo" src="http://lorempixum.com/100/100/abstract" alt="" /></a>
        <div>
            <h1>AlanHoRizon</h1>
            <h3>Site description</h3>
        </div>
    </div>
    <div id="content">
        <p>Lorem ipsum dolor ...</p>
    </div>
    

    CSS:

    #header:after {
        display: block;
        clear: both;
        content: ".";
        visibility: hidden;
        height: 0; 
        line-height: 0;
    }
    #logo {
        float: left;
    }
    #header div {
        float: left;
        padding: .25em;
    }
    

    And here’s the complete jsfiddle example

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a float left image with a title and a small text on
Currently I have an image like this (created by CKEditor): <img src=foo.jpg style=float: left;
always the same structure. image (with float:left) text image (with float:left) text image (with
.fooBar { float: left; display:inline-block; height: 600px; margin-right: 0px; } $('.fooBar').click(function(){ $(this).css('margin-right', '20px'); });
I have this CSS code : #d_image { float: left; width: 320px; margin-top: 20px;
I have a div and it contains elements like this: <div class='anyClass' style='float:left'> <ul
I'm wrapping text around an image using markup something like this: CSS: #imgAuthor {
I have been trying to create LI elements with float left and an image
Here's a before and after picture. When I add a float:left to the li,
<div id=surveyTitleEdit style=float:left;overflow: auto;> <input id=surveyTitleInput size=25 type=text name=Title /> <span><img class=pointerCursor src=image alt=Save

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.