CSS - Trying To Get An Element To Move Up Next To Another
Hi, I am trying to get image on the bottom right hand side of the page to align with the chart in the middle.
I have it floated to the right, but I can't seem to make it move up vertically. Not sure how to do this, absolute positioning is not an option because it will be stuck there regardless of browser size. this is where the img is now, see how it is not lined up? URL this is where it is supposed to go. URL my code is this Code: <div style="float:right; vertical-align:baseline;"><img src="/free-gold-charts/gold.png" alt="Free Interactive Gold Charts" width="320" height="290" align="top"/></div> and I have it next to the code for the chart. Help! Similar TutorialsHi, My page has 3 elements: one at the top(header banner), one in the middle (a middle content area) and one at the bottom (footer banner). Now I want those positions to remain intact regardless of the number of lines output in the middle element. The content is going to be determined at runtime by a server-side routine so I don't want to use a fixed positioning for the footer banner. I want it to be displayed at the bottom - after the middle content is displayed. And I want the middle content to be visible in the page i.e. I don't want a scroll area within the page. I have tried various approaches and read up on positioning but so far have not been able to do it using css. Any help is much appreciated. Jim I have an navigation menu that I am building as an unordered list. What I have is an image rollover that appears at the bottom of the navigation menu when the cursor hovers over one of the first level links by using a span within the link that has its display set to none, and then set to absolute positioned directly below the navigation menu on a:hover. Here is an example: Code: <ul> <li> <a href="link1.html" id="link1">Link<span></span></a> </li> </ul> .link a { some link height } .link a span { display: none; } .link a:hover span { position: abolute; top: (some link height * the number of links); background-image: (some image url) width: (image width) height: (image height) } Appearance: ------ Link1 Link2 Link3 Link4 ------- ------- Rollover Image to appear here ------- The problem that I have is that since the rollover image is positioned absolutely, if the size of the list of links changes (IE with sub-links in the list) it slides under or over where I have the rollover image placed. IE ------ Link1 sublink1 sublink2 Link2 Link3 Link4 ------- will break my scheme. Is there a way to get the span within the link to show up relative to the bottom of the <ul> element, or at the bottom of an element that contains the whole shebang? If I cant get this to work, I'm going to be forced to adopt the existing tables/javascript based template for our site, and I'd hate hate hate to do that. thanks. Can anyone explain the difference between the two? For example, what is the difference between: this: element element {} div p { } and this: element > element { } div > p { } I don't understand it and have not found an explanation in tireless searching. Thx! On this page: http://lfswear(dot)com/sites/lfs2/index.php?main_page=product_info&cPath=1&products_id=8 I can't seem to get the "Size" div to move over right to match up with the color one... Any help would be greatly appreciated. Hi I am creating a new site for a friend in Wordpress ilovelifebecause.com I can usually muddle through in css to make changes, but i'm stumped at the moment. What I am trying to do is swap around the two cream coloured boxes so the larger one is on the right, the thinner one on the left and the blue box in the middle still. I've tried a number of things in the css file but can't seem to find the right method - can anyone help? many thanks in advance Paul I'm trying to make a menu using only css basically when you hover over an li element if there is another level below it a div is moved into place to reveal the links. It is working for the top level, but I can't figure out why it won't display/work for the 3rd tier. Both the css and the html validated, a link and the code is below. Thanks for any advice. edit: I can't actually post the link but I will PM it to anyone who wants to see it halfway working. HTML: ------------------------- <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "edit:no links"> <html> <head> <title>Test Page for drop menu</title> edit:there would be an include for the css here but I can't post anything resembling a link </head> <body> <div id="menuHolder"> <ul> <li><a href="#url">Advising Network</a> <div class="subHolder"> <ul> <li><a href="#url">Student PASSPort</a> <div class="bottom"> <ul> <li><a href="#url">Test 1</a></li> <li><a href="#url">Test 2</a></li> <li><a href="#url">Test 3</a></li> <li><a href="#url">Test 4</a></li> </ul> </div> </li> <li><a href="#url">Adivsor PASSPort</a> <div class="bottom"> <ul> <li><a href="#url">Test 1</a></li> <li><a href="#url">Test 2</a></li> <li><a href="#url">Test 3</a></li> </ul> </div> </li> <li><a href="#url">Form Bank</a></li> <li><a href="#url">Timeline</a></li> <li><a href="#url">Videos</a></li> <li><a href="#url">Contact</a></li> </ul> </div> </li> <li><a href="#url">Career Investigations</a> <div class="subHolder"> <ul> <li><a href="#url">Student</a> <div class="bottom"> <ul> <li><a href="#url">Test 1</a></li> <li><a href="#url">Test 2</a></li> <li><a href="#url">Test 3</a></li> <li><a href="#url">Test 4</a></li> </ul> </div> </li> <li><a href="#url">Alumni</a></li> <li><a href="#url">Parents and Family Members</a></li> <li><a href="#url">Employers</a></li> <li><a href="#url">eRecruiting</a> <div class="bottom"> <ul> <li><a href="#url">Test 1</a></li> <li><a href="#url">Test 2</a></li> </ul> </div> </li> </ul> </div> </li> <li><a href="#url">Campus Life</a> <div class="subHolder"> <ul> <li><a href="#url">Student and University Life</a></li> <li><a href="#url">Student Activities</a></li> <li><a href="#url">Commuter Services</a></li> <li><a href="#url">Community Service Learning</a></li> <li><a href="#url">USM Partnership with STRIVE U</a></li> <li><a href="#url">USM Calendar of Events</a></li> </ul> </div> </li> <li><a href="#url">Scholarships and Finances</a></li> <li><a href="#url">Academic Success</a> <div class="subHolder"> <ul> <li><a href="#url">Academic Strategies</a></li> <li><a href="#url">Courses</a></li> <li><a href="#url">Additoinal Support Resources</a></li> </ul> </div> </li> <li><a href="#url">Major Discovery</a> <div class="subHolder"> <ul> <li><a href="#url">Being Undeclared</a></li> <li><a href="#url">GO Program</a></li> <li><a href="#url">Aspirations - Early Study</a></li> <li><a href="#url">Choosing Your Major</a></li> <li><a href="#url">FAQ</a></li> </ul> </div> </li> <li><a href="#url">Orientation</a></li> </ul> </div> </body> </html> CSS ------------------- a {text-decoration:none; color:#ffffff;} #menuHolder {height:60px; background:#0072ad; position:relative; text-align:center; width:1000px; font-size:16px; margin:0px;} #menuHolder ul {list-style:none;} #menuHolder ul li {float:left; padding:0px 10px 0px 10px; line-height:60px;} .subHolder {position:absolute; left:0px; top:200px; overflow:hidden; font-size:14px; background:#0083ad;} #menuHolder ul li:hover .subHolder {left:0px; top:60px; width:1000px; text-align:center; height:60px;} #menuHolder ul li:hover {background:#0083ad;} /* sub menu */ .subHolder ul {list-style:none;} .subHolder ul li {float:left; padding:0px 10px 0px 10px; line-height:60px;} .bottom {position:absolute; left:0px; top:500px; overflow:hidden; font-size:12px; background:#0094ad;} .subHolder ul li:hover .bottom {left:0px; top:120px; width:1000px; height:60px; text-align:center; line-height:60px;} .subHolder ul li:hover {background:#0094ad;} /*bottom level*/ .bottom ul {list-style:none;} .bottom ul li {float:left; padding:0px 10px 0px 10px;} http://members.cox.net/sherry72/index.html that is my website. I have a stats box to the right but i want it exactly to the right of my content box. It is underneath right now. How do i change the css to make it like i want it? Hi all, Helping out a buddy, but am stuck myself. Possibly simple fatigue. At this site, I'd like to move the entire center container up so that it's only about 20px below the very top. As of right now, when I do this, the top BG image disappears. As you can see from the CSS, there's actually two BG images. I don't want that, I merely want the center container to cover the BG. How, please? Thanks! Chris Hi, Am editing a template within dreamweaver as it saves a lot of time for me but I can figure out how to move the right nav bar down. Am trying to include a screenshot but i can't figure out how as I am a new user and it won't let me link.. Basically, it is a two column layout with a picture under the heading and the nav bar up to the height of the picture. Am looking to expand the picture out right and center meaning the nav bar will have to come down just below the picture if you know what i mean? I have tried with design view, won't let me. Had a look at the code but nothing really there that I picked up on (considering am only a beginner).. any thoughts? sorry I posted it again by mistake.. please delete Hi, I am looking to move my nav bar into the center www.leehughes.co.uk Am not sure how to do this, am worried about messing up the IE hacks.. Code: ul#nav { height:1.75em; border-top:1px solid #000; border-bottom:1px solid #646060; list-style:none; margin:0; /* reset the default left margin in IE */ padding:0 .5em 0 0; /* reset the default left padding in good browsers */ background:#000; font-size:1em; } #nav li { position:relative; /* establish stacking context for the AP'd dropdown sublist */ float:right; padding:0; line-height:1.75em; } #nav li a { float:left; padding:0 .5em; border-right: 1px solid #333; color: #CCCCCC; text-decoration: none; } #nav li a.first {border:none;} #nav li:hover, #nav li.sfhover{ background:#transparent;/* background for all links on hover */ visibility:visible;/* makes IE7 think something changes on hover, fixes IE sticking dropdown */ } #nav li:hover a, #nav li.sfhover a {color:#FFF;}/*1st level font color on hover*/ /*=== All Sublist Styles ===*/ #nav ul { position:absolute; /* position the sublist to nearest positioned ancestor, the (#nav li) in this case*/ width:12em; /*150px*/ margin-left:-999em;/* hide the sublist */ padding:0; left:0; /* IE6/7 need this to position the sublist correctly on hover*/ top:1.75em; background: url(fake-image.jpg);/* IE needs some sort of BG on the nested ul */ } #nav li li { float: none;/*reset the float from #nav li*/ display:block; height:auto; line-height:1.5; border:none;/*reset borders from #nav li*/ } #nav li li a { float: none;/*reset the float from #nav li*/ display:block; width:11em;/*IE6 needs a width (12em total with padding)*/ padding:0 .5em; border:0; } * html #nav li li a {display:inline-block;} /*hide an overflow bug in IE6*/ *+html #nav li li a {display:inline-block;} /*hide same overflow bug in IE7*/ /*=== Hide All Sublists ===*/ #nav li:hover ul, #nav li.sfhover ul { margin-left:-999em; } /*=== Sublist Font Colors ===*/ #nav li:hover li a, #nav li.sfhover li a {color:#FFF;} /*2nd level font color*/ #nav li li:hover a, #nav li li.sfhover a {color:#003366;} /*2nd level font color on hover*/ /*=== Second Level UL position on hover ===*/ #nav li:hover ul, #nav li.sfhover ul { margin-left: 0; /* show the sublist (line up with left border on main list items)*/ } Thanks Hello all, More or less, i'm trying to replicate a spreadsheet type of thing online. hxxp://img241.imageshack.us/img241/4100/imagewm.jpg The white bar stays at a fixed y axis (height) no matter how far down the page you scroll. I just used position: fixed to accomplish this. However, I need it to stay stuck to the left side of the page (not just the visible browser window) at the same time. I can do this, however by making it stick to the left of the page (and thus scroll with the content when you scroll left and right), the bar will no longer scroll up and down at a fixed height I hope this makes sense to you all - if needed I can give a live demo to show what i'm talking about. I've been trying to figure this out for a while now, and no luck. Any and all help or direction is appreciated! Andrew i am writing a site for fun to learn how websites work. The site i write right now will be like a school newspaper. I have one problem with the background, at the begining i couldnt make it no repeat but later i did it, now, i got something wrong with my code. PLease help me here is my code: ( i mean that the back ground color does not appear!! Code: <html> <head> <title> blah blah </title> </head> <body bcolor="#004d79"> <center> <img src="/pics/banner.png"> </center> <h4> <b> <center> blah blah </center> </b> </h4> <style type="text/css"> <!-- body {background-image: url(pics/background.png); background-repeat: no-repeat;}set to background-repeat: no-repeat;background-position:center; </style> <center> <b> (C) blah blah </b> </center> <center> <div style="position:absolute;top:130px;left:375px"> <h1> <b> <p> Our website is under construction!!<br>Thank you for visiting us!! </p> </b> </center> </h1> </div> <div style="position:absolute;top:250px;left:260px"> <b> <p> blah blah </p> </b> </center> </div> </html> Thanks alot, J. http://www.dudley.nhs.uk/ In FF it all works fine but sometimes in I.E. left menus disappear and the right menu overlapping the text on the page isn't unknown. Although this is resolved by refreshing the page, it is happening quite regularly and is causing some confusion. What do I need to add to my CSS to sort this toothache of a problem out? Thanks Hello; Could anyone tell me how to addjust my result to the top(10% away from the top)? please. I try to use margin-top:10%, but it does not work. Please go to my website http://www.businessfind101.com/ and type the sentence with "MySql YourSql" into search function, you will see the result in the button, i have not idea to move them up. and my code as following; Code: php session_start(); $aString=$_REQUEST["SText"]; $_SESSION["aString"]=$aString; ?> <!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" xml:lang="en" lang="en"> </head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <style type="text/css"> table.display{margin-top:10%} </style> <body> <?php $con = mysql_connect("localhost", "#*$!","1#*$!"); if (! $con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("#*$!x", $con); $result = mysql_query("select * from Customer2"); // was it a success if (!$result) die ("Error processing request - check your query"); // process results $nrecs = mysql_num_rows($result); /* Use tab and newline as tokenizing characters as well */ $tok = strtok($aString, " "); while ($tok!== false) { $len=strlen($tok); $len=$len/2+1; $tok=substr($tok,0,$len); $b="tu"; $myresult=mysql_query("SELECT * FROM Customer2 WHERE MATCH (Topic,Des) AGAINST ('$tok*' IN BOOLEAN MODE);"); while($row=mysql_fetch_array($myresult)){ echo "<br>"; echo "<br>"; echo " "; $Cid=$row['Cid']; echo " "; $row['Count']=$row['Count']+1; $Count=$row['Count']; mysql_query("update Customer2 set Count='$Count' where Cid='$Cid'"); } $tok = strtok(" "); } $result = mysql_query("select * from Customer2"); echo "<table border=0 width=50% class='display' bgcolor='ccffff'>"; //i will display result on the screen while ($row=mysql_fetch_array($result)){ if($row['Count'] >0){ echo "<tr><td>"; echo $row['Des']; echo "</td><td>"; echo $row['Count']; echo "</td> </tr>"; } } $f=0; mysql_query("update Customer2 set Count='$f'"); echo "</table>"; mysql_close($con); ?> </body> </html> In css I can get 2 objects to display on right hand side at top of page easy enough. I don't want to use absolute positioning for an object's position. I have to position an object relative to another object eg this object should go underneath this object, can i do this ? I use this , and is this the best way you can do it? position:relative; right=-240;top=0 ok in my site I have set the header and the menu as absolute because I want the header to go over the container and the menu to go over the header but my problem is that when I zoom in or out my header and menu move position to the left is there a way to make them not move their position but still have them one on top of the other this is my site for now (it's my course at uni and I have to include all those pages in it) http://padrewa.comeze.com this is my css code for: Code: body { background-color: #FFF; } #wrapper { background-color: #FFF; } #header { * border:#999 0px solid; position: absolute; opacity: 0.50; filter:alpha(opacity=50); } #menu { * border:#999 0px solid; position:absolute; padding-top:80px; padding-left:180px; } #content { border:#999 0px solid; background-color:#FFFF99; width:1050px; padding-top:110px; padding-bottom:70px; margin-left: auto; margin-right: auto; } #footer { border:#999 0px solid; background-color:#FFFF99; width:1050px; margin-left: auto; margin-right: auto; } and this is my header template I included it in my page using php: Code: <div id="header"><table> <tr> <td><a href="index.php"><img src="style/logo.jpg" alt="Logo" height="100" /></a></td> </tr> </table> </div> <link rel="stylesheet" href="style/style.css" type="text/css" media="screen" /> <div id="menu" > <a href="index.php"><b>Home Page</b></a> <a href="gallery.php"><b>Gallery</b></a> <a href="biography.php"><b>Biography</b></a> <a href="draw.php"><b>Draw</b></a> <a href="write.php"><b>Write</b></a> <a href="contact.php"><b>Contact Me</b></a> </div> Hi; Why my buttom move from right to left after i click on the button? How i can stop it to do that? Thanks my code as following; Code: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> <META HTTP-EQUIV="content-type" CONTENT="text/html; charset=utf-8"> <title>Welcome to you</title> <style type="text/css"> html,body{ padding: 0; margin:0; } #container { position: relative; width: 796px; /* width + border for IE 5.x */ w\idth: 790px; /* real width */ height:310px; border: 0px; padding: 0; margin-top: 10px; margin-bottom:auto; margin-left: auto; margin-right: auto; background-color:#f0f0ec; } #wrapper{ position: relative; left: 10px; top: 15px; } table{ border:1px solid #90bade; padding:0; width: 350px; height:200px; float: left; background-color:#FFFFFF; position: relative; margin-left: 20px; margin-right:auto; margin-top:auto; margin-bottom:auto; } #button { width: 12em; border-right: 1px solid #000; padding: 0 0 1em 0; font-family: 'Trebuchet MS', 'Lucida Grande', Verdana, Lucida, Geneva, Helvetica, Arial, sans-serif; background-color: #BFBEBA; color: #333; float: left; position: relative; margin-left: 10px; marging-right:20px; marging-top:10px; marging-bottom:auto; } #button ul { list-style: none; margin: 0; padding: 0; border: none; } #button li { border-bottom: 1px solid #C5C9CB; margin: 0; padding:0; } #button li a { display: block; padding: 5px 5px 5px 0.5em; border-left: 10px solid #666666; border-right: 10px solid #CCCCCC; background-color: #999999; color: #fff; text-decoration: none; width: 100%; text-align:center; } html>body #button li a { width: auto; } #button li a:hover { border-left: 0px solid #1c64d1; border-right: 0px solid #5ba3e0; background-color: #2586d7; color: #fff; } </style> </head> <body> <div id="container"> <div id="wrapper"> <div id="button"> <ul> <li><a href="#">Home</a></li> <li><a href="#">Travel</a></li> <li><a href="#">About Us service</a></li> <li><a href="#">Contact Us</a></li> <li><a href="#">Booking</a></li> <li><a href="#">Education</a></li> <li><a href="#">Testing</a></li> <li><a href="#">Testing</a></li> </ul> </div> <table> <tr> <td> test</td> </tr> </table> </div> </div> </body> </html> |