473,725 Members | 2,248 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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">Hom e</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 3205
On 2008-06-11, Liam Gibbs <li*******@symp atico.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">Hom e</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...he re 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_U s.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
25744
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 blah blah blah blah </div> </div> </div>
4
5238
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 from a text file. The last value is variable length- the shortest return is about 300 characters, and the longest is about 6000 or so. This SSI lives inside a <div> on a page with a few other text <div>s; a simplified example of the layout is: ...
1
12895
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 that it looks like 1 image by overlapping them using css. I have tried creating a seperate div for each image and setting the top/left the same on both and changing the layer on each. This only made the 2nd one display directly below the first...
2
5107
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 redesign on Ben Meadowcroft's templates which behave impeccably. Under IE using text sizes 'small' and 'smallest' the RHS div ends up overlapping the central content div. I've worried at this for so long I'm at the stupid stage. ...
2
19748
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 be put there, then div1 will be hidden and div2 content will be visible. The problem I am having with this is that the content is still lining up right beneath each other. If I make div1 hidden, then there is just white space where it used to...
3
2606
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 recognise that the navigation links (menucol) if the div behind it (container-page) overlaps. As far as I've tested it renders as desired in IEmac, FfoxMac1.0.6, NNmac7.2, and IE6-PC.
2
4816
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 positioned (either absolutely or relatively) in a way that they overlap each other. when i assign an onmousemove event to them, only one of them catches it. any capturing and/or bubbling is beeing performed by parents of the div that caught the...
1
2260
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 overlapping? thanks <!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>
0
8889
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, well explore What is ONU, What Is Router, ONU & Routers main usage, and What is the difference between ONU and Router. Lets take a closer look ! Part I. Meaning of...
0
9401
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9257
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8099
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development projectplanning, coding, testing, and deploymentwithout human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6702
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupr who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6011
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4784
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2637
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2157
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.