Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Basic Question - Positioning a logo in a header but inline with the left edge of a container with HTML/CSS

Featured Replies

So I'm relatively new to Html and CSS but I can't work out how to get the logo to stay in a fixed position relative to the wrap.

 

At the moment I have the logo a certain percentage from the left side of the browser but obviously with different resolution screens the logo is going to be in different places.

 

I'm guessing I need a Header container? http://themash.com/blog/entertainment/2012/08/04/ya-author-john-green-connects-with-fans-to-do-good/ At least this website does but I can't work out what they've done to achieve the fixed logo.

 

Thanks

Well I'll explain the structure of the website you provided.

 

Basically, the website's main content is wrapped in a container div that has a width of 100%. Within that container are divs for each major section of the website (header, menu body) with a set width of about 1000 pixels and they're vertically centered. This produces the effect you want to accomplish in that the logo you see is simply aligned to the left side of the 1000 pixel centered div.

 

This is what you call a "fixed layout". Here's an example in case what I've written above is confusing.

 

<div id="Container" style="width: 100%">
<div id="Header" style="margin-left: auto; margin-right: auto; width: 1000px; height: 100px;">
 <div id="Logo" style="float: left;"></div>
</div>
<div id="Menu" style="margin-left: auto; margin-right: auto; width: 1000px;"></div>
...
</div>

Edited by Pete Prosper

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.