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.

Positioning Relative Content After Absolute without Knowing Element Height

Featured Replies

I am using absolute positioning in a relative DIV to position two images over each other and I then want to put the main navigation underneath this banner header. I can't use a fixed height because the content is responsive. Does anyone have any suggestions apart from using a dummy spacer DIV and using javascript to get and set the relevant element heights every time the window is resized (surely there's an easier way).

 

Here's the code and CSS. I want the "nav" div to appear directly under the "banner".

 

<header class="wrapper clrfix" >
<div id="banner" style="width:100%; position:relative">
<img class="abs" src="img/photo.png">
<img class="abs" src="svg/vector_logo.svg">
</div>
<div id="nav" class="wrapper clrfix">
<!-- main navigation -->
<nav id="topnav">
<div class="mnu-toggle">Menu</div>
<ul class="srt-mnu" id="mnu-main-nav">
<li><a href="/index.shtml">Home</a></li>
<li><a href="info/news.shtml">News</a></li>
<li><a href="reviews/index.shtml">Reviews</a></li>
<li><a href="blog/index.shtml">Blog</a></li>
<li><a href="#">About Us</a></li>
</ul>
</nav>
<!-- end main navigation -->
</div>
</header>
========
CSS
========
img.abs{position:absolute;top:0;left:0}
Thanks in advance.
Paul

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.