473,387 Members | 1,493 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Overlapping DIVs: one isn't blocking the other

Hello everyone.

I'm having a problem with a web page. What I have is one DIV (a
header) overlapping the border around another DIV (a menu block). I
want this, because I want to put this header overtop the border of the
menu. The problem is that the border is still showing through the
text, giving it a strikethrough appearance. What I need is for the
menu header to block that part of the border. An example is here:
http://www.altmarvel.net/Liam/whatiwant.jpg. The first menu is what
I'm getting, and the second is what I need.

I first tried a background image which was just a black square and set
the background-repeat attribute. That didn't work (and, since the
colours of the site will probably change, I'd have to create a new
background image every time I try a new colour set).

I've done a search on the Internet and in this group, but haven't come
up with anything quite like what I need. (Maybe I'm using the wrong
search string?) Does anybody have any solutions?

Here is my CSS code. If you know a more efficient way of doing this,
I'd love to hear it.
menu-header {
font-size: .8em;
margin-bottom: -5px;
border-left: 1px solid;
border-right: 1px solid;
width: 60%;
}

In case it matters, here is my HTML code:
<div class="menu-header">Main Menu</div>
<p class = "box-menu">
<a class = "menuitem" href = "index.php">Home</a><br>
<a class = "menuitem" href = "Products.php">Products</a><br>
<a class = "menuitem" href = "Locations.php">Locations</a><br>
<a class = "menuitem" href = "Accounts.php">Accounts</a><br>
<a class = "menuitem" href = "Contact_Us.php">Contact Us</a>
</p>
Thanks, everyone!
Jun 27 '08 #1
2 3169
On 2008-06-11, Liam Gibbs <li*******@sympatico.cawrote:
Hello everyone.

I'm having a problem with a web page. What I have is one DIV (a
header) overlapping the border around another DIV (a menu block). I
want this, because I want to put this header overtop the border of the
menu. The problem is that the border is still showing through the
text, giving it a strikethrough appearance. What I need is for the
menu header to block that part of the border. An example is here:
http://www.altmarvel.net/Liam/whatiwant.jpg. The first menu is what
I'm getting, and the second is what I need.

I first tried a background image which was just a black square and set
the background-repeat attribute. That didn't work (and, since the
colours of the site will probably change, I'd have to create a new
background image every time I try a new colour set).
Just set a background colour-- if you don't set one you get background:
transparent.

The image should have also worked.

You also need to make sure menu-header is stacked on top of box-menu,
which may mean for example adding position: relative and z-index: 1 to
menu-header.
Jun 27 '08 #2
Liam Gibbs wrote:
Hello everyone.

I'm having a problem with a web page. What I have is one DIV (a
header) overlapping the border around another DIV (a menu block). I
want this, because I want to put this header overtop the border of the
menu. The problem is that the border is still showing through the
text, giving it a strikethrough appearance. What I need is for the
menu header to block that part of the border. An example is here:
http://www.altmarvel.net/Liam/whatiwant.jpg. The first menu is what
I'm getting, and the second is what I need.

I first tried a background image which was just a black square and set
the background-repeat attribute. That didn't work (and, since the
colours of the site will probably change, I'd have to create a new
background image every time I try a new colour set).

I've done a search on the Internet and in this group, but haven't come
up with anything quite like what I need. (Maybe I'm using the wrong
search string?) Does anybody have any solutions?

Here is my CSS code. If you know a more efficient way of doing this,
I'd love to hear it.
menu-header {
font-size: .8em;
margin-bottom: -5px;
border-left: 1px solid;
border-right: 1px solid;
width: 60%;
}

In case it matters, here is my HTML code:
<div class="menu-header">Main Menu</div>
<p class = "box-menu">
<a class = "menuitem" href = "index.php">Home</a><br>
<a class = "menuitem" href = "Products.php">Products</a><br>
<a class = "menuitem" href = "Locations.php">Locations</a><br>
<a class = "menuitem" href = "Accounts.php">Accounts</a><br>
<a class = "menuitem" href = "Contact_Us.php">Contact Us</a>
</p>

Firstly I would use a list for your links, because it IS a list of links...

Need to specify a background...here is one way with only 1 class...

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>template</title>

<style type="text/css">
body { color: #fff; background: #000; }
div.menu {
width: 8em; /* adjust for content */
position: relative;
padding: 1em .25em .25em .25em; /* pad top for header */
}
div.menu div {
/* postion header where you want */
position: absolute; left: 1.25em; top: .25em; width: 6em;
/* color it */
color: #fff; background: #000;
border-left: 1px solid #fff; border-right: 1px solid #fff;
text-align: center;
}
div.menu ul {
font-family: sans-serif;
margin: 0; padding: .5em;
border: 1px solid #fff;
list-style: none
}
div.menu a {
/* mimic your design...not what I would do */
text-decoration: none;
color: #f00;
}
</style>
</head>
<body>

<div class="menu">
<div>Main Menu</div>
<ul>
<li><a href="index.php">Home</a></li>
<li><a href="Products.php">Products</a></li>
<li><a href="Locations.php">Locations</a></li>
<li><a href="Accounts.php">Accounts</a></li>
<li><a href="Contact_Us.php">Contact Us</li>
</ul>
</div>
</body>
</html>

--
Take care,

Jonathan
-------------------
LITTLE WORKS STUDIO
http://www.LittleWorksStudio.com
Jun 27 '08 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Peter Jenkins | last post by:
I have some divs I am using to get a two column layout for a section of a page, like so; <div1> <div2> <div3> blah blah blah blah blah blah blah blah...
4
by: smiley | last post by:
I hope this is the right forum for this question; i know it crosses over a few topics but here goes. I have a page that uses a server-side include perl script to return a list of name/value pairs...
1
by: Mitch | last post by:
I have 2 rectangle images. 1 with a box in the upper left corner and the other with a box in the lower right hand corner. Both images are the same size. I would like to display these 2 images so...
2
by: Daphne Tregear | last post by:
Is there every anything other than woe with IE...? I'm working on a redesign for my hobby pages in my personal home space before re-exporting them back to where they belong. I've based the...
2
by: Kalvin | last post by:
I am very new to CSS and am trying to set up 2 divs in the same space on the page. The idea is that div1 will be an informational message only displayed sometimes. When there isn't a message to...
3
by: michelle koen | last post by:
Hi Folks, on <a href="http://donbrice.com/new/page.php?section=schools">this page</a> and for all the sections I can't get Safari(2.02) or Firefox-PC(1.5) or the latest vers. of Opera-Mac to...
2
by: Jakub Ɓukomski | last post by:
hi. i've got a problem as follows, to which i can't find a solution to: i've got two divs, which are completely independent of each other (neither is a parent of child of another). they're...
1
by: spolsky | last post by:
hi, i have the following html. if padding given for the span it overlaps the divs within IE 6, FireFox 1.5 and Opera 9.01. i don't want to give sizes manually. how could i prevent this...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.