CSS - Css, Navigation And Highlighting A Heading
H all,
I have a horizontal navigation bar which basically looks like this: Thing0 | Thing1 | Thing2 | Thing34 What I want to do is when I select a link to a new page, I'd like (using CSS) to have that link highlighted so that the user can see which page he is on. It's either that or hardcoding the name to each page...but since it's already in the Nav bar, I thought highlighting the link on the nav bar serves as a heading as well... Possible? Similar TutorialsI am 99.99999% sure that there is no way to do this in pure CSS but just in case. I have tabbed navigation. When a user clicks on a link it loads that page from the server (a page refresh). The corresponding nav tab should then be in its active state. Does CSS support this at all? I am happy to run a server side script to set an item to "current" but I would like to know if there is any way around it. Thanks. Hi guys. The strangest thing happened to me a few minutes ago. I tried centering the heading for my webpage using css in dreamweaver. When I looked it up on the browser to see whether it checked out right, to my horror, I discovered that the heading had disappeared. Could someone tell me what went wrong? thanx kaz. I'm trying to put together a CSS layout for a blog, and unfortunately my meager skills have crapped out on me. The page currently looks like this: http://prestonandtread.com/test/ I want it to be a full screen header while the footer is fixed and the width of the content. I thought I had it pieced together ok enough from different tutorials, but the top and left sides of the screen show background and the content isn't parking itself on the page correctly. Help me get this to where it should be! Code: <style type="text/css"> html, body { margin:0; padding:0; height:100%; /* 100 % height */ } #header { width: 100%; height: 150px; } html>body #header { position:fixed; z-index:10; /* Prevent certain problems with form controls */ } html>body #wrap {height:100%;} /* 100 % height */ #wrap { width:479px; margin:0 auto; } html>body #content-wrap {height:100%;} /* 100 % height */ html>body #content {padding:10px 10px 10px 10px;} /* 6em = height of #header and #footer + 1em, 1em = give the content some breathing space */ #footer { width:479px; height:160px; } html>body #footer { position:fixed; bottom:0; z-index:10; } html, body { background-color: #99CCFF; } #header { text-align: center; background-image: url(background.jpg); background-position: top left; background-repeat: repeat-x; background-color: #99CCFF; } #footer { text-align: center; background-image: url(eyes.jpg); background-color: #99CCFF; } #content-wrap, #content { background-color: #FFFFFF; } #footer a {color:#111;} </style> Again I am new to CSS so bear with me here...I did search this forum before posting this... I am using a 3 column template, I am having some problems between the "#columns" with the heading <h*> of these columns. as long as each column has a differnt heading size all is well but if two columns have the same size heading I can't seem to be able to make them different colors Hi everybody. I am developing a site for classic games, and I am having trouble putting a navigation list on the left of my page and aligning a heading on the right with the top of the list border. Code: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html lang="en"> <head> <title>Choose a Page</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <style type="text/css"> /* <![CDATA[ */ body { font-family: arial; font-size: 12pt; margin: 0; padding: 0; } h1, h2 { text-align: center; } ul { margin: 0; width: 25%; height: 20em; padding: 0; border: .5em solid #00f; list-style-type: none; list-style-position: outside; } li { background-color: #0ff; padding: .5em 0 .5em; } li a { background-color: #0f0; height: 1em; padding-left: .5em; display: block; font-weight: bold; } /* ]]> */ </style> </head> <body> <h1>Game Index</h1> <ul> <li><a>Home</a></li> <li><a href="dir.html" title="View the Directions">Directions</a></li> <li><a href="gbc.html" title="View GameBoy/GameBoy Color games">GameBoy/GB Color</a></li> <li><a href="gba.html" title="View GameBoy Advance games">GameBoy Advance</a></li> <li><a href="nes.html" title="View Nintendo/Famicom games">NES/Famicom</a></li> <li><a href="snes.html" title="View Super NES/Super Famicom games">SNES/Super Famicom</a></li> <li><a href="ggear.html" title="View Game Gear games">Game Gear</a></li> <li><a href="genesis.html" title="View Genesis MegaDrive games">Genesis/MegaDrive</a></li> <li><a href="32x.html" title="View 32X games">32X</a></li> <li><a href="psx.html" title="View PlayStation games">PlayStation</a></li> </ul> <h2>Select a page</h2> <div id="pgdesc">Please make a selection from the list above</div> <h3>Note: This page does not host ANY emulators. You have come to the wrong place if you are looking for an emulation site.</h3> <div id="img"> <img id="atari" src="atari2600.jpg" alt="Atari 2600"> </div> </body> </html> I realize that a list and a heading are both block-level elements, but I'm wondering... I'd rather not use absolute positioning since it doesn't work well with different resolutions. I'm just wanting it to work with 800x600 and 1024x768 resolutions. Can anybody help? Hi, I am trying to add a 8px border under my headings, but I only want it to go as far as the word. At the moment, it is going the whole width of my div container. This is what I have at the moment: PHP Code: #sidebar h2, #sidebar h3 { color: #444; font-size: 20px; font-weight: normal; margin: 0px 0 5px 0; padding: 0px 0 0px 0; border-bottom: 8px solid #FE9023; } Any help would be great. Thanks Is there a way I can have the checkbox to the right of the heading without stretching out the actual heading? It works fine when it is floated to the left http://www.iankovi.com/html_.html http://www.iankovi.com/css_.css I have 3 images that I would like to go togather to form a heading with rounded corners. I want to use 3 div tag to accomplish this. I am unable to get all 3 to lign up Code: .rounded_STYLE{ background-color: #fff; border: 1px solid BORDER_COLOR; position: relative; } .rounded_STYLE{background:url('/images/chg.gif') repeat-x; } .rounded_STYLE > .tl, .rounded_STYLE > .tr, .rounded_STYLE > .bl, .rounded_STYLE > .br{ width: 6px; height: 24px; position: absolute; } .rounded_STYLE > .tl{ background: url(/images/clg.gif) top left no-repeat; } .rounded_STYLE > .tr{ background: url(/images/crg.gif) top right no-repeat; } .rounded_STYLE > .tc{ background: url(/images/chg.gif) top right no-repeat; } .rounded_STYLE > .bl{ background: url(/images/bl.png) bottom left no-repeat; } .rounded_STYLE > .br{ background: url(/images/br.png) bottom right no-repeat; } Code: <div class="rounded_STYLE rounded"> <div class="tl"></div> <div class="tc"><table class="h"><tr><td class="l"></td><td>dddddddddd</td><td class="r">ssssssss</td></tr></table></div> <div class="tr"></div> ... contents of the block go here ... <div class="bl"></div><div class="br"></div> </div> Hi All, I am building a site that has the following structure for the navigation; Code: <div id="navigation"> <ul id="navlist"> <li class="home"><a href="../index.asp" title="home"><span>home</span></a></li> <li class="aboutus"><a href="../aboutus.htm" title="aboout us"><span>about us</span></a></li> <li class="ourservices"><a href="../ourservices.htm" title="our services"><span>our services</span></a> <ul> <li class="internationalmail"><a href="ourservices_internationalmail.htm" title="international mail"><span>international mail</span></a></li> <li class="worldwidecourier"><a href="ourservices_worldwidecourier.htm" title="worldwide courier"><span>worldwide courier</span></a></li> <li class="worldwidefreight"><a href="ourservices_worldwidefreight.htm" title="worldwide freight"><span>worldwide freight</span></a></li> <li class="storage"><a href="ourservices_storage.htm" title="storage"><span>storage</span></a></li> <li class="publishingservices"><a href="ourservices_publishingservices.htm" title="publishing services"><span>publishing services</span></a></li> </ul> </li> <li class="requestquote"><a href="../requestquote.htm" title="request a quote"><span>request a quote</span></a></li> <li class="contactus"><a href="../contactus.htm" title="contact us"><span>contact us</span></a></li> </ul> </div> The main LI is horizontal, and the containing UL, LI is a vertical dropdown. The seperate CSS file does the image replacements on the <a> and hides the text within the <span>, usual stuff. The nav works great, with the graphic rollovers etc. The rollover, again, standard way of doing it, background: url(<FILE>) no-repeat top left; and the a:hover rollover is a background: bottom left;. Edit: Just noticed that I can't link to the full site that I have uploaded for preview. What I want to do, is when the user roll's over any of the items within the sub-navigation, it keeps the main Services navigation link rolled over also. The only way I could think of doing this, and relatively simply, would be to use JavaScript, but wanted to explore any other CSS ways of doing this. For example, is it possible to change a style of another class, from another? Your help would be much appreciated! I'm trying to figure out how to do something like this: Code: <h6>Lorem Ipsum Dolor <span>jan 10 2006</span></h6> And make the heading line up to the left side and the span on the right. It's close. It's lining up on the right but on the next line down rather than the same line. Take a look. Any bright ideas on why this is happening or how to fix it? Thanks. This is probably something extremely simple, but I'm the slow kid today... I have a right-hand sidebar with a heading that is not behaving the way I want it to. After each word, it creates a new line, then the next word.... Any suggestions, as always, are appreciated. Here's the page: http://www.websimage.com/pcqtest/index.html Thanks guys/gals :) Hey everyone, the admins have implemented a new hack to the forums, allowing you to post your code with nicely coloured text rather than just the normal black or the old php stuff. More details can be found he http://forums.devshed.com/t279108/s.html Html code: [hig hlight=html4strict]your code here[ /highlight] For example: html4strict Code: Original - html4strict Code <?xml version="1.0" encoding="iso-8859-1"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Untitled Document</title> </head> <body> <h1 class="header_text"> Nice One! </h1> <p id="main_content"> <span style="color:red;">Lorem ipsum</span> dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. </p> </body> </html>
The same goes for CSS highlighting: [hig hlight=css]your code here[/high light] css Code: Original - css Code /*Comments*/ body { property:value; } body, div { property:value; }
As you can see from the thread I linked, there are many many other languages supported, but these three examples are more likely to be used than any other in this particular forum... Have fun with it, and please do use this feature, I'm sure it will make things much easier for us to read/understand, rather than just posting chunks of code. Enjoy! --Jon. Seems that if class's are applied to individual TD tags, no matter how i try to implement row highlighing, the TD class will overide the highlighting color. A simple way to implement row highlighting is: <TR onmouseover="this.style.backgroundColor='navy';" onmouseout="this.style.backgroundColor='grey';"> however, a TD with a class that set's a DIFFERENT backgroundColor will disregard the TR mouseover. Any help? My Goal: using an onmouseover, highlight the mouse-overed table cell red and highlight another table cell green. Code: <head><style type='text/css'> .cell1 { background-color: #cccccc; } .cell1_over { background-color: #ff3366; } #other_cell { background-color: #cccccc; } </style></head> <body> <table> <tr> <td class='cell1' onmouseover='this.className="cell1_over";' onmouseout='this.className="cell1";'>words</td> <td id='other_cell'>more words</td> </tr> </table> </body> OK - the above code will change the first cell from grey to red no problem. What I want is to not only make the first cell grey but also the other cell turn green under the same onmouseover. How might I go about this? Thanks in advance! Hi all, I am trying to prevent the highlighting of text on my site only on a product description. I currently employ techniques using the BODY tag, but I believe this is doing more harm than good because it does not allow highlighting/cutting in any other areas. I have seen some class(es) on other sites where highlighting was not permitting ONLY in the product description (a table) Is there a way to disable highlighting of text "IN A TABLE" via CSS or JAVA, and without the tricks of transparent layers and IFrames? Thanks much in advance Is it possible to define a style (color) for all instances of a certain word, say " blue " by means of CSS only? That is, not defining anything in the HTML code. If the above is not possible, how to highlight the word "blue" using the least amount of tags in the HTML code? I have created a bit of CSS similar to the way faqs are expanded and contracted by clicking. It constitutes a list of maxims some of which are further expanded and some of which are not. An example of this is displayed here, http://yogaredux.meripol.net/node/12. What I am looking for is some kind of CSS which is content depended. If the answer part is filled I want it to have a different colour from when it is empty. Is there any kind of Javascript, CSS or a combination of the two that can implement it? hi there, i am currently designing a page for a client, where i use menu highlighting (active, hover, focus). the menu is arranged in a list with two sublevels. -> menu top 0 -> level 1 -> link 1 -> link 2 etc... my aim is to let only the currently active menu be in a different color than all the others. what actually happens is that all submenus as well are highlighted. her is the code: Code: #right ul.menu, #left ul.menu { margin: 0; padding: 0 0 0; list-style: none; } #right ul.menu li, #left ul.menu li { margin: 0 !important; padding: 0 !important; background: none !important; } #right ul.menu li a, #left ul.menu li a { padding: 4px 0; display: block; border-bottom:1px solid #dadada; text-decoration: none; outline: none; color: #666; } #right ul.menu li a:hover, #right ul.menu li a:active, #right ul.menu li a:focus, #left ul.menu li a:hover, #left ul.menu li a:active, #left ul.menu li a:focus { color: #FE642E; border-bottom:1px solid #dadada; text-decoration: none; background:#fff; } #right ul.menu li.active, #left ul.menu li.active { color: #FE642E; text-decoration: none; font-weight:normal; } #right ul.menu li.active a, #left ul.menu li.active a { color: #FE642E !important; text-decoration: none; font-weight:normal; } #right ul.menu li ul, #left ul.menu li ul { margin: 0; padding: 0; list-style: none; } #right ul.menu li li, #left ul.menu li li { padding: 0 0 0 10px !important; list-style: none; } #right ul.menu li li a, #left ul.menu li li a { font-size: 92%; font-weight: normal; background: url(../images/arrow.png) no-repeat left !important; padding-left:10px !important; border-bottom:1px solid #dadada; color: #666; } #right ul.menu li li a:hover, #right ul.menu li li a:active, #right ul.menu li li a:focus, #left ul.menu li li a:hover, #left ul.menu li li a:active, #left ul.menu li li a:focus { color: #FE642E; } #right ul.menu li.active a:hover, #left ul.menu li.active a:hover { color: #FE642E !important; text-decoration: none; font-weight:normal; border-bottom:1px solid #dadada; background:#fff; } URL i have added a screenshot to visualize the problem, the only link in orange should be 'Menu A'. thank you in advance, sebastian The new version of the website I work on is now structured using CSS to position divs, whereas the old site was done entirely using tables. The thing is, it's no longer possible to select the text properly now its inside div tags - many of the other divs get highlighted completely, and the target text gets highlighted in an unpredictable manner - whereas on the old site, with its table format, this was not a problem. Please help! Hey, I'm building a rather elaborate javascript popup menu, and I'm trying to get some distinction between some of the long-text menu items. I have no padding after the <p> tags because then I get an extra space at the bottom of my menu. So I'm trying get a hanging indent to work: my CSS styles: .question_indent { text-indent:-10px; padding-left: 10px; } .popupmenu p{ color: white; font-size: 0.80em; display: block; padding-left: 6px; padding-right: 6px; margin-top:0px; margin-bottom:0px; } Here's my problem: with my javascript highlight-on-hover function, the hightlight starts in the middle of the first letter of the menu item with a hanging indent. I can't figure out a way to get around it (e.g. can't find anything on google). function subhighlight(obj) { if (subhighlighted!=null) { //unhighlight last link subhighlighted.style.background = ""; subhighlighted.style.color = "#f7f7f7"; } subhighlighted=obj; if (subhighlighted!=null) { //highlight current link subhighlighted.style.background = "#f7f7f7"; subhighlighted.style.color = "#376092"; } } Here's some of my menu item code: sublinkset[0]= '<p class="question_indent">llooong text repeat llooong text repeat llooong text repeat llooong text repeat.</p>' sublinkset[0]+='<p class="question_indent"><a href="about_us.html" id="11">But that\'s just a summary. Click to read more.</a></p>' |