April 5, 201115 yr On this topic its about simple links using CSS. For example: Home | About Me | Contact Me I have these links with hovering backgrounds which was very easy to do. But lets say you click "about me", I want the background to stay on that link when visiting that page. (I hope this makes sense) For example check out oxfam.org.uk While Im here, Is it possible to use CSS to hover over a DIV Box to change the background colour ? (I know I can use the "Roll over image" but I like to use CSS) I have put my website portfolio on hold for a couple of months. I have been approached by two charity campaigns called "NEYCE" & "Running Man", I also have a meeting next week with a local band wanting a website and talking to some Free Runners wanting a website. I have offered to do these for free as these are my first projects, I'm quite excited. Facebook is a great way to promote my business as we say lol. I'm liking this website very good and getting a lot of help from you guys, Thank you very much. I'm only 21 and I'm in lot of debt, I want to change by career and hope to become a freelance webdesigner
April 5, 201115 yr http://www.crearedes...e-page-php.html Or if you are not using php, then structure the page link you are on as below <li class="current"><a href="yourpage.html">Your Page</a></li> then add the class current to your css
April 5, 201115 yr Author Thank you both, Whats with the <li> ?.. I dont use that because I get this stupid dot sitting beside the last link lol
April 5, 201115 yr Author Or if you are not using php, then structure the page link you are on as below <li class="current"><a href="yourpage.html">Your Page</a></li> then add the class current to your css That's not doing anything.. <il class="current"><a href="index.html">Home</a></il> } .current{ background-color: #F90; }
April 5, 201115 yr While Im here, Is it possible to use CSS to hover over a DIV Box to change the background colour ? (I know I can use the "Roll over image" but I like to use CSS) ... HTML <div id="yourideahere">Something</div> CSS #youridhere:hover { background-color:#ff000; }
April 5, 201115 yr Author ... HTML <div id="yourideahere">Something</div> CSS #youridhere:hover { background-color:#ff000; } I should of known that, Very easy to do. Thank you
April 5, 201115 yr Author ..I'm still stuck with this link thing. My website is not online yet so I can not use the PHP so I like to stick with the CSS.
April 5, 201115 yr ..I'm still stuck with this link thing. My website is not online yet so I can not use the PHP so I like to stick with the CSS. There is no way to do it with CSS unless you add the class manually to the link that is the active/current page. You have to go through and for each HTML file, you add class="current" to the appropriate navigation element. Then you style it appropriately. You should always use a list for your navigation because semantically a navigation is a list (and screen readers except this), as well as li elements being MUCH easier to style. To remove the dot you just set the list-style-type to none. http://www.w3schools.com/css/pr_list-style-type.asp
April 6, 201115 yr You can do with by giving your body tag a class and then calling that as the pa rent when styling links. [list][*]<a href="#">menu 1[*]<a href="#">menu 2[/list] #mainnav ul {list-style-type:none;}#mainnav li {float:left;padding-left:6px;padding-right:6px} Now if you create a class for the current page link using the body class as well as the ul class the page will style the current page link using the page body tags class.This does mean using a different style for every page so you're still better off with PHP
April 6, 201115 yr Author Thank you very much. I have gone with the "current" CSS style on each page (Only have 5 pages), It has worked like a treat. PHP I will need to go on some learning course when I raise enough money in the future, No point me putting it all up and not having a clue what It means. Thank you both for helping
Create an account or sign in to comment