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

  • Home
  • SEARCH
  • 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 9259757
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T12:44:00+00:00 2026-06-18T12:44:00+00:00

First, this is my HTML <div class=header> <div class=wrapper> <div class=navi> <a href=# class=logo>Logo</a>

  • 0

First, this is my HTML

<div class="header">
  <div class="wrapper">
    <div class="navi">
      <a href="#" class="logo">Logo</a>
      <ul><!--
        --><li><a href="#" class="navlink">Link 1</a></li><!--
        --><li><a href="#" class="navlink">Link 2</a></li><!--
      --></ul>
    </div>
  </div>
</div>

<div class="wrapper">
  <div class="content">
    <p>"Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."</p>
  </div>
</div>

and CSS

.wrapper {
    width: 90%;
    max-width: 50em;
    margin: 0 auto;
}

.header,
.navi {
    width: 100%;
}

.header {
    background: grey;
}

.navi {
    background: green;
    display: table;
    text-align: center;
}

.navi ul {
    display: table-cell;
    vertical-align: middle;
    text-align: right;
}

.navi li {
    background: orange;
    display: inline;
    margin-left: 10px;
}

.navilink {
    display: inline-block;
    width: auto;
}

.logo {
    background: red;
    float: left;
}

.content {
    width: 100%;
    background: fuchsia;
}

Fiddle
Fullscreen Fiddle

You see, the wrapper ensures that there is always some kind of gap between content and edge of the viewport and beyond a certain point (50 em), the .wrapper doesn’t exceeds any further.

The code I posted here works, but I would like to know if there is any chance to get rid of <div class="wrapper"> achieving the same result. I already tried to apply the .wrapper class directly to the elements, but that isn’t working – why?

To clarify: My aim is it to make the markup cleaner. That’s why I am interested in a solution then ensures that the elements behave like in the example I posted, but without the use of <div class="wrapper">. The class .wrapper has to stay of course, it’s just that div that strikes me. Thats why I tried to add .wrapper directly to the elements.

  • 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-18T12:44:01+00:00Added an answer on June 18, 2026 at 12:44 pm

    Remove the wrapper div, and add the two CSS properties to the content div..

    .content { 
    margin: 0 auto;
    max-width: 50em;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I currently have this code HTML <div class=table> <div class=header-row> <div class=header-cell>First Name</div> <div
I'm developing a html with this structure div id=menuContainer> <div class = menu ui-accordion-header
Suppose a HTML like this: <div id=header> <span class=title>Title</span> <!-- more spans and other
have a problem. At first look at this HTML <div id=map style=background-image: url(map.png); width:
Here's my HTML. Apologies for formatting - this is my first-ever question! <div id=Template>
First off the html row looks like this: <tr class=evenColor> blahblah TheTextIneed blahblah and
I've got html like <div class=header><div class=title>AAAAAAAAA</div></div> <div class=body> <div class=card><div class=xxx><div class=yyy><div class=title>AAAAAAAAA</div></div></div></div>
I have this html structure: <div id=home> <div class=section_header> <h1 class=left data-target=newest><?=lang('home_newest');?></h1> ... </div>
this is HTML <p>x1</p> <p>x2</p> and i want css to select first < p>
I am trying to make kind of online gallery, this is first .html doc

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.