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.

Help With Css - Menu Bar With 4 Floating Boxes

Featured Replies

I am trying to create a layout with a menu bar down the left side and 4 boxes arranged in a square next to it.

I have attached an image of what the site currently looks like.

I want the menu bar to extend to the bottom of the screen and the 4 boxes arranged as they are in my screenshot to the right of the menu.

 

My code looks like this:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>phpBI</title>
<style type="text/css">
<!--
body {
	margin: 1px;
	font-size:12pt;
}
a {
	color:white;
}
#ContentArea {
	position: absolute;
	border:1px solid black;
	width:99%;
}
#menu {
	position:absolute;
	background:#8e4b38;
	width:100px;
	height: 50px;
}
#block1 {
	position: relative;
	background:#9dce58;
	width:400px;
	height:200px;
	float:left;
	margin:20px;
}
#block2 {
	position: relative;
	background:#83a6c4;
	width:400px;
	height:200px;
	float:left;
	margin:20px;
}	-->
</style>
</head>

<body>

<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
	<td height="98" background="Images/banner.png">
	<div align="right">
		<img src="Images/Circles.png" width="316" height="98" alt="Circle">
	</div>
	</td>
</tr>
<tr>
	<td height="40" background="Images/menu.png" style="vertical-align:middle"> 
		<strong>
		<a href="#">Home</a>
		</strong>
	</td>
</tr>
</table>


<div id="menu">
	Menu
</div>
<div id="block1">
	<div id="blockHeader">Block1</div>
</div>

<div id="block2">
	Block2
</div>

<div id="block2">
	Block3
</div>

<div id="block1">
	Block4
</div>

</body>
</html>

 

Can someone point out what I need to add/change to my CSS?

post-2170-1207920890_thumb.jpg

since you've given the boxes a fixed height couldn't you simply give your menu a fixed height of say 480px or am i missing the point?

  • Author

womble: Thanks for the reply.

To get the look I was after I changed #menu to

#menu {
	position:relative;
	float:left;
	background:#8e4b38;
	width:100px;
	height:400px;
}

This gives the desired effect.

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.