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 9141205
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T09:36:53+00:00 2026-06-17T09:36:53+00:00

Hi I am trying to create a responsive layout where I have three different

  • 0

Hi I am trying to create a responsive layout where I have three different size elements and I want an equal margin on both sides of middle element for all screens.

Here is my HTML and CSS

<section class="container">
    <div href="/" class="pull-left logo"><img src="/images/logo.jpg"></a>
    <div class="slogan pull-left"><img src="/images/slogan.jpg"></div>
    <div class="pull-left support"></div>
</section>

<style>
 .pull-left
{
  float-left;
}
.slogan 
{
  margin: 0 17%;
}    
</style>

Since logo and support sections are of fixed size. Above Css works fine for one resolution but as screen size goes down the margin doesn’t remain same.

Any ideas how to achieve that?

EDIT: Here is the fiddle. http://jsfiddle.net/VdYua/22/
Initially there is an equal margin on both side of .slogan div. But on re size last div goes to next line. I want the margin to be decreased without braking layout.

  • 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-06-17T09:36:54+00:00Added an answer on June 17, 2026 at 9:36 am

    Are you looking for something like this?

    HTML:

    <div class="centered">This is some content in the centered DIV</div>
    

    CSS:

    .centered { background: #888; margin: 0 auto; width: 50%; }
    

    Using margin: 0 auto will center the elements horizontally, meaning that it will have “Equal margin on both sides”

    You do have to set a width on elements when using the above method, but as shown you can use percentage widths (as I image you may well be for a responsive layout)

    You cannot however use this technique on floated elements, so you may be looking to add something like this to your CSS:

    .container { margin: 0 auto; width: 50%; }
    

    If I have misunderstood your question please let me know.

    EDIT: In response to the comment below I think I have managed to achieve what you’re looking for, see this fiddle

    HTML:

    <section class="header">
    
      <div href="/" class="logo"><img src="/images/logo.jpg" /></div>
    
      <div class="slogan"><img src="/images/slogan.jpg" /></div>
    
      <div class="support"></div>
    
    </section>
    

    CSS:

    .header { padding: 0 50px 0 300px; position: relative; }
    
    .logo, .support { background: red; height: 50px; position: absolute; top: 0; }
    .support { background: blue; right: 0; width: 50px; }
    .logo { left: 0; width: 300px; }
    
    .slogan { background: black; height: 50px; margin: 0 auto; width: 50px; }
    

    The positioning/padding aspect of things isn’t particularly pretty (if the width of .support or .logo change, you have to change that in the css) however I think this is the only safe way of doing it with pure HTML/CSS in a cross browser way (I’d be interested to see anyone elses take on it though), the important this is that it works and is completely valid.

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

Sidebar

Related Questions

I'm trying to create a responsive gui, which basically means that I have an
I am trying to create a fluid/responsive layout where the same HTML would render
Hi i am trying to create my first fluid responsive layout and i am
I'm reading some books and trying to create a responsive layout but still don't
I'm trying to create a responsive website with a fixed navigation only when the
I have been trying to create a website with a fixed header but which
I am trying to create a layout/style editor similar to what is available on
I'm trying to make a simple, fluid, responsive two column layout (just for the
I'm trying to create responsive design webpage. it works well with my table and
Hi I wonder if anyone can help, I'm trying to create a responsive site

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.