CSS - Using Css To Have Text Overlap An Image?
Right now, I'm using CSS to have text overlap an image. I did this simply by having the placement code for the text appear after the placement code for the image in my .shtml file.
Is this the correct way of doing this? Similar TutorialsI'm working on this page: http://development.maklafpress.com/index.asp. I'm experimenting w/ sandbagging to get the text to wrap around that logo. The page looks perfect in IE, but in Opera, Firefox and Netscape the logo creeps up above the nav bar and screws everything up. Could some one help me out? I've attached the CSS below: Code: #content { background: url(maklaf.jpg) no-repeat top left; } #wrap1 { width: 180px; height: 110px; float: left; clear: left; padding: 0; } #wrap2 { width: 209px; height: 90px; float: left; clear: left; padding: 0; } #navcontainer ul { padding-left: 0; margin-left: 0; background-color: #036; color: White; float: left; width: 100%; font-family: arial, helvetica, sans-serif; } #navcontainer ul li { display: inline; } #navcontainer ul li a { padding: 0.2em 1em; background-color: #036; color: White; text-decoration: none; float: left; border-right: 1px solid #fff; } #navcontainer ul li a:hover { background-color: #369; color: #fff; } Hi I have this page http://www.networkhealthgroup.co.uk/new/jobs.htm I have put borders around the columns, when viewed in IE you will see that the main content div overlaps the right column. You will also see that the right border is looks alot more than 140px wide in IE than it does in Firefox!!! Does anyone know what I am doing wrong here? I need this menu to be halfway on the content section, however it keeps getting pushed around. I can't figure out what to change for positioning to move it over! Help HTML: Code: <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <link rel="stylesheet" type="text/css" href="layout.css"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled Document</title> </head> <body> <div id="wrapper"> <div id="main"> <p>Insert Content Here</p> <p>Insert Content Here</p> <p>Insert Content Here</p> <p>Insert Content Here</p> <p>Insert Content Here</p> <p>Insert Content Here</p> <p>Insert Content Here</p> <p>Insert Content Here</p> <div id="nav"> <ul> <li><a href="#">Home</a></li> <li><a href="#">Products</a></li> <li><a href="#">About</a></li> <li><a href="#">Gallery</a></li> <li><a href="#">Contact Us</a></li> </ul> </div> <!--Close #nav--> </div> <!--Close #main--> <!--Close #wrapper--> </body> </html> CSS: Code: @charset "utf-8"; /* CSS Document */ body { background-color:#000; font-family: arial, helvetica, sans-serif; margin: 1em; } #wrapper { } #main { background-color:#FFF; width:80%; } <!--margin: 0em auto;--> #nav { float:left; margin-left:-7em; margin-top:0; } #nav ul { list-style-type:none; } #nav a { display: block; color: green; background-color: navy; width: 5em; padding: .2em .5em; text-decoration: none; font-size: 1.25em; } #nav a:hover { background-color: blue; color: dark green; } How do I get it to overlap and to get the text/images to wrap around the nav menu? Good Morning All, Been having a slight problem with the visual in the screenshot below. The blue line is our H2, and the purple one is our H3, however, as you can see, the underline spans the entire width of the column, not just underneith the text, which is our requirement. ***As i am not allowed to upload a url as a new user, the underline is as follows. With the text centre aligned. text ----------------------------------------------------------- rather than text ------ and obviously by the css, the underline on the headers is a small image, repeated - x. Please see relevant css information. * (line 23) { margin-top: 0pt; margin-right: 0pt; margin-bottom: 0pt; margin-left: 0pt; padding-top: 0pt; padding-right: 0pt; padding-bottom: 0pt; padding-left: 0pt; } h2, h3, h4, h5, h6 (line 101) { font-size: 1.2em; font-weight: normal; padding-bottom: 4px; margin-top: 0.6em; margin-right: 0pt; margin-bottom: 0.8em; margin-left: 0pt; text-align: center; } .contentArea h2, #secondaryNavigation h2 (line 114) { background-color: transparent; background-image: url("../images/h2_gradient_bg.gif"); background-repeat: repeat-x; background-attachment: scroll; background-position: left bottom; color: #0066cc; } Many Thanks in advance. Marc. Hi. See code below. Why does the outer SPAN in TABLE not grow with the image height. If the text is longer so it is forced below image then it looks as it should. Please also read some comments in the code. Code: <html><body><center><br><br> Why does image not force the outermost span to be at least as high as image?<br> If the text are long enough and gets below the bottom border of image it look good though.<br><br> NOTE: I need to put Image and text either within separate span or in same span as the examples below.<br> In my real application I'm using an <a href=" ...> around the outer span in examples below.<br> <br><br> <table border=1 cellpadding=0 cellspacing=0 width=200px><tr><td> <span style="display:block; background-color:#ffa827; padding-top:10px; padding-left:10px; padding-right:10px;"> <span style="display:block; float:left"> <img src="landscape.jpg" height="40px" width="40px" alt="" border="0"> </span> <span style="display: block; color: white;"> Text here. </span> </span> </td></tr></table> <br><br> <table border=1 cellpadding=0 cellspacing=0 width=200px><tr><td> <span style="display:block; background-color:#ffa827; padding-top:10px; padding-left:10px; padding-right:10px; color: white;"> <img src="landscape.jpg" height="40px" width="40px" alt="" border="0" style="float:left"> Text here. </span> </td></tr></table> </center></body></html> Hi, I would like to superimpose (overlap) one small image over the second larger one, to a left bottom corner of that larger. The thing is I do not know the width & height of larger image as it is loaded dinamicly with php. I tryied puting large image to table than position small image to div with style="position:relative; left:0px; bottom:0px; z-index:33;" not working, can you help? Hello! I have a flash header and I'm wondering how to make an img (jpg/png) overlap a flash header? It seems that the flash keeps covering my img when i use positionsomething) Thanks! I have a project that someone else coded in the first place and I am trying to make some fixes on it. I have tried a ton of things but do not know exactly what is wrong with the layout. If you visit musaferthefilm.com/test/index2.html you can see the layout and how the navigation spans past the rest of the container. I am not sure if this is very complex to fix but I have tried everything. I appreciate your help! Thank you. Hello all - I will be so grateful if someone can help me. I'm not sure why, but my right column is overlapping my footer. I have been working too long and my brain is dead! I cannot figure it out for the life of me. Can someone please tell me what I did wrong? I am trying to have the header, 3 columns, left-fixed, right-fixed, center fluid. I want the footer to span all 3 along the bottom, which it is doing. But the right column is overlapping. Code: #header {background: #ffffff; height: 120px; margin: 0; padding: 0} #content {margin: 0} #wrap {min-width:770px;margin: auto;position:relative} #main #content-wrap {position:relative;width:100%} #main #content {margin: 0 235px auto 175px} #content-wrap {position:relative;width:100%} #leftnav {position:absolute;top:0;left:0px;width:150px} #sidebar {position:absolute;top:0;right:5px;width:200px;} #footer {positon:relative; background-image: url(../imag /bottom.jpg); background-repeat: repeat-x;} With the structure as such: Code: <body id="main"> <div id="wrap"> <div id="header"> </div> <div id="content-wrap"> <div id="leftnav"> </div> <div id="content"> </div> <div id="sidebar"> </div> <div id="footer"> </div> </div> </div> </body> I have decided that it would be easier to make 2 seperate div tags so I wouldn't have to deal with the issues on margin and padding that IE barf all over at. So, what I'm going to do is to make the 2nd <div> to overlap the 1st <div>. So, what the property or attribute that I can use to make it the overlapping work that work for most web browsers?? Thanks, FletchSOD Hey guys, It might be easiest if you see the example first: http://www.venusadvertising.com.au/ourwork.php See how the red tab overlaps the Flash element in Webkit browsers and under it in IE? I need the page to scroll rather than for the elements to overlap. CSS doc is he http://www.venusadvertising.com.au/_assets/css_venus.css Thanks for your help! Ham Thanks for taking the time to read my question. I have a horizontal UL for a nav bar. It works great, and positions well in IE, but in FF the ContentBox moves too far up, and overlaps with my nav bar. I can't figure out why. I added an extra div and placed the nav bar in that, but that didn't help either. What am I doing wrong. Also, I have my widths set to 100% IE has no horizontal scroll bar at the bottom, but FF does. Not sure what is going on here either. thanks again for your help. Brad HTML: Code: body { background-color: #48494D; padding: 0px; margin: 0px; } #Head1 { background-color: #000000; width: 100%; height: 100px; padding-left: 20px; } #Head2 { background-color: #ffffff; width: 100%; height: 45px; border-bottom: solid #CCCC99 2px; padding-left: 130px; } #MainNav { width: 100%; height: 20px; background-color: transparent; } #navcontainer ul { padding-left: 25px; margin-left: 0; background-color: transparent; color: #CCCC99; float: left; width: 100%; font-family: arial, helvetica, sans-serif; } #navcontainer ul li { display: inline; } #navcontainer ul li a { /*padding: 0.2em 1em 0em 0em;*/ background-color: transparent; color: #CCCC99; text-decoration: none; text-align: center; float: left; border-right: 1px solid #CCCC99; width: 134px; font-size:12px; border-bottom: 4px solid #48494D; } #navcontainer ul li a:hover { border-bottom: 4px solid #CCCC99; text-align: center; } #navcontainer ul li.LastOne a { border: 0 none; } #navcontainer ul li.LastOne a:hover{ border-bottom: 4px solid #CCCC99; } #ContentBox { width: 800px; height: 400px; margin: 0px auto; background-color: aqua; display: block: } #CBHeader1 { background-image:url(SecondHeaderImg.jpg); height: 50px; width: 800px; } CSS: Code: body { background-color: #48494D; padding: 0px; margin: 0px; } #Head1 { background-color: #000000; width: 100%; height: 100px; padding-left: 20px; } #Head2 { background-color: #ffffff; width: 100%; height: 45px; border-bottom: solid #CCCC99 2px; padding-left: 130px; } #MainNav { width: 100%; height: 20px; background-color: transparent; } #navcontainer ul { padding-left: 25px; margin-left: 0; background-color: transparent; color: #CCCC99; float: left; width: 100%; font-family: arial, helvetica, sans-serif; } #navcontainer ul li { display: inline; } #navcontainer ul li a { /*padding: 0.2em 1em 0em 0em;*/ background-color: transparent; color: #CCCC99; text-decoration: none; text-align: center; float: left; border-right: 1px solid #CCCC99; width: 134px; font-size:12px; border-bottom: 4px solid #48494D; } #navcontainer ul li a:hover { border-bottom: 4px solid #CCCC99; text-align: center; } #navcontainer ul li.LastOne a { border: 0 none; } #navcontainer ul li.LastOne a:hover{ border-bottom: 4px solid #CCCC99; } #ContentBox { width: 800px; height: 400px; margin: 0px auto; background-color: aqua; display: block: } #CBHeader1 { background-image:url(SecondHeaderImg.jpg); height: 50px; width: 800px; } Hello, I have 3 Divs as follow: <div id="Container"> <div id="Header">header</div> <div id="Text">text</div> </div> I need the following: 1. Both "Header" and "Text" div's top left corner to be align at top left of "Container" div 2. "Text" div should be over "Header" div hiding it. How can I do this? Thanks, Miguel Greets, I'm having trouble with the menu not being properly shown in IE. The list is supposed to pass over the central DIV, and... the bugger seems to want to stay in the background for some reason. I set that div's z-index well above the others, set the visibility to visible... I'm stumped. teh linkification Hi. Really hoping someone can help me with this... I'll try and explain this as best I can(!) Basically I've got a page containing a block of 9 images, with each linking to a video clip. At the moment I've got the CSS coded so that whenever the mouse is hovered over the 'infobar' (at the bottom of each image) it goes from having a transparent background with black text to having a grey background with white text. What I'm trying to achieve is that same effect whenever the mouse is hovered over any part of the image and infobar. The live online link can be found at: www.markmcm.co.uk/test/test.html The CSS is as as follows: Code: /* * Page Stylesheet */ body { font-family: Arial, Helvetica, sans-serif; background-color: #eaeaea; border:0; margin:0; padding:0; height: 100%; } a:link { text-decoration: none; } a:visited { text-decoration: none; } a:hover { text-decoration: none; } a:active { text-decoration: none; } #container { margin-left: auto; margin-right: auto; min-height: 100%; width: 936px; } * html #container { height: 100%; } #content { float:left; position: relative; height: 528px; width: 936px; z-index: 0; } .miniscreen1, .miniscreen2, .miniscreen3, .miniscreen4, .miniscreen5, .miniscreen6, .miniscreen7, .miniscreen8, .miniscreen9 { position: absolute; float: left; display: block; width: 312px; height: 176px; } .miniscreen1 { top: 0; left: 0; } .miniscreen2 { top:0; left: 312px; } .miniscreen3 { top: 0; left: 624px; } .miniscreen4 { left: 0; top:176px; } .miniscreen5 { left: 312px; top:176px; } .miniscreen6 { left: 624px; top:176px; } .miniscreen7 { left: 0; top:352px; } .miniscreen8 { left: 312px; top:352px; } .miniscreen9 { left: 624px; top:352px; } .info { height: 30px; top:3px; left: 40px; width: 265px; float: left; position: absolute; } .infobar { left:0px; position: absolute; top: 140px; width: 312px; height: 36px; outline: none; color:#000; background: url("data/infobar.png") no-repeat 0 0; z-index: 650; } .infobar:hover { background-position: 0 -36px; outline: none; color:#fff; } #infobar span { display: none; outline: none; } .clip_title { outline: none; font-size: 85%; font-weight: 700; vertical-align: top; text-align: left; } .clip_sub { outline: none; height: 13px; font-size: 80%; line-height: 13px; font-weight: 700; vertical-align: top; text-align: left; } And the HTML is: Code: <!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"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Test Page</title> <meta name="description" content=" " /> <meta name="keywords" content=" " /> <meta name="generator" content=" " /> <link rel="stylesheet" type="text/css" href="page.css" media="screen" /> </head> <body> <div id="container"> <div id="content"> <span class="miniscreen1"> <a href="#"> <img src="img/clip1.jpg" width="312" height="176" border="0"> <span class="infobar"><span class="info clip_title">Test Clip 1<br><span class="clip_sub">123 Productions</span></span></span></a> </span></span> <span class="miniscreen2"> <a href="#"><img src="img/clip2.jpg" width="312" height="176" border="0"> <span class="infobar"><span class="info clip_title">Test Clip 2<br><span class="clip_sub">123 Productions</span></span></span></a> </span></span> <span class="miniscreen3"> <a href="#"><img src="img/clip3.jpg" width="312" height="176" border="0"> <span class="infobar"><span class="info clip_title">Test Clip 3<br><span class="clip_sub">123 Productions</span></span></span></a> </span></span> <span class="miniscreen4"> <a href="#"><img src="img/clip4.jpg" width="312" height="176" border="0"> <span class="infobar"><span class="info clip_title">Test Clip 4<br><span class="clip_sub">123 Productions</span></span></span></a> </span></span> <span class="miniscreen5"> <a href="#"><img src="img/clip5.jpg" width="312" height="176" border="0"> <span class="infobar"><span class="info clip_title">Test Clip 5<br><span class="clip_sub">123 Productions</span></span></span></a> </span></span> <span class="miniscreen6"> <a href="#"><img src="img/clip6.jpg" width="312" height="176" border="0"> <span class="infobar"><span class="info clip_title">Test Clip 6<br><span class="clip_sub">123 Productions</span></span></span></a> </span></span> <span class="miniscreen7"> <a href="#"><img src="img/clip7.jpg" width="312" height="176" border="0"> <span class="infobar"><span class="info clip_title">Test Clip 7<br><span class="clip_sub">123 Productions</span></span></span></a> </span></span> <span class="miniscreen8"> <a href="#"><img src="img/clip8.jpg" width="312" height="176" border="0"> <span class="infobar"><span class="info clip_title">Test Clip 8<br><span class="clip_sub">123 Productions</span></span></span></a> </span></span> <span class="miniscreen9"> <a href="#"><img src="img/clip9.jpg" width="312" height="176" border="0"> <span class="infobar"><span class="info clip_title">Test Clip 9<br><span class="clip_sub">123 Productions</span></span></span></a> </span></span> </div> </div> </body> </html> There must be a better (and easier?) way to do this. Any help would be very-much appreciated - and save an old bloke from tearing too much of his hair out(!) Alright, I am developing a new website. I am using a watermark that begins in header and goes over the css menu in box. The positioning of all containers is correct and it views perfectly. I have a wrapper around those 2. *The issue is when the zindex is high it shows water mark beginning in header and stretches over the menu, when that happens the menu will not work properly. If I lower the zindex then the css menu covers bottom of my watermark it works, but then you cant see bottom half of my water mark. The water mark is in .png format. Hello, I am working with something like this: Code: <div>content one here</div> <table><tr><td>content two here</td></tr></table> How can I get the div to overlap the table and appear on top of it? Thanks! I am sitting here with a css challenge and I cannot even start to imagine how to do it. In fact, I think it is impossible to do, but just thought I'd ask you guys in case I am wrong: I want to create a dropdown menu (something like coolmenus) that can be created dynamically out of a database. The first thing I want to happen is that all primary navigation items are lined up horizontally next to eachother. That one was easy: I put each item into a DIV and float them left. Now the problem: whenever a user moves the mouse over a primary navigation item, a dropdown menu will appear underneath it. However (!), this dropdown menu may be wider than the DIV above it! Here an example: ------------- ------------- | Item 1 | | Item 2 | ------------- ------------- ----------------------- | Dropdown 1 | ----------------------- ----------------------- | Dropdown 2 | ----------------------- The problem I see is that I want the dropdown menu to always be left aligned with the primary navigation item. As I don't know the absolute position of either of them (being created dynamically out of a database), the only way to get the left alignment is to write the DIVs (primary item and its dropdown) directly after each other in the code. However, if I do that I cannot get the primary navigation items to appear one next to each other. Well, I could, but they wouldn't overlap with the dropdowns as I want them to. To give you an idea of what I am trying to achieve, have a look at the dropdown he http://www.rmitenglishworldwide.com...ts/products.asp I am using IDs to contain hidden text. I am using mouse over behaviors to change the text's visibility so that it is shown. Now here is the thing; I want to display two IDs of text. Since I have to set the position to absolute, otherwise they scroll down the page, the texts overlap. Things I have tried. - Using a span class of: top 100px; at the end of every ID to lower it from the second. This doesn't work because it is CSS and it reads every span class not like javascript. - Putting them in another ID and limiting the size of Box, scroll down the page. The position has to absolute so this is out. Here is what I am working on: www silverrose.net/zodiac2.htm I know I can change the page so it would work for now; but it won't work for what I am planning down the road. Maybe I should give up my efforts and try using javascript; but there HAS to be a way to do this with CSS. Any suggestions from you brilliant peeps? I have a large footer that does not clear all the content in Safari. It is fixed to the bottom of the browser window, and when resized slightly, the footer then breaks free and shows all content. Please see page below for example. Footer covers some of the last row of items... when you resize the window, items become visible: www[dot]asadvertising[dot]com/portfolio[dot]html |