Welcome to Code Forum!

Join a community that supports you and your coding journey from day one. We strive to be a friendly, supportive community that empowers everyone to be better developers. By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!
  • Guest, before posting your code please take these rules into consideration:
    • It is required to use our BBCode feature to display your code. While within the editor click < / > or >_ and place your code within the BB Code prompt. This helps others with finding a solution by making it easier to read and easier to copy.
    • You can also use markdown to share your code. When using markdown your code will be automatically converted to BBCode. For help with markdown check out the markdown guide.
    • Don't share a wall of code. All we want is the problem area, the code related to your issue.

    GIF shows where to locate </> in the thread and or post editor toolbar.
    To learn more about how to use our BBCode feature, review our "How to post your code into threads" here.

    Thank you, Code Forum.

Navigation bar style once clicked

Edrol97

Silver Coder
Hi all,

I have several navigation bars on my site but I would like to create a once clicked dependent on the page that it is on to match the navigation bar's hover style. Illustration of the styles I have on hover are below.
 

Attachments

  • Screenshot 2024-06-29 at 00.13.38.png
    Screenshot 2024-06-29 at 00.13.38.png
    825.6 KB · Views: 3
  • Screenshot 2024-06-29 at 00.13.26.png
    Screenshot 2024-06-29 at 00.13.26.png
    2.5 MB · Views: 3
  • Screenshot 2024-06-29 at 00.13.09.png
    Screenshot 2024-06-29 at 00.13.09.png
    1.1 MB · Views: 3
  • Screenshot 2024-06-29 at 00.12.55.png
    Screenshot 2024-06-29 at 00.12.55.png
    672.6 KB · Views: 3
  • Screenshot 2024-06-29 at 00.12.00.png
    Screenshot 2024-06-29 at 00.12.00.png
    1.8 MB · Views: 3
You may need specific code for each. If you want a different hover once clicked you may need JavaScript. X E.
 
You may need specific code for each. If you want a different hover once clicked you may need JavaScript. X E.
Ah right, so far I've just done it as so:

HTML:
   <div id="mailnavigationbar">
            <a href="Home.html" style="font-size: 5dvh; font-weight: 900; text-decoration: underline;">Hi</a>
            <a href="about_me.html">Bio</a>
            <a href="Art.html">Show-Off</a>
            <a href="cv.html">CV</a>
            <a href="Inspa.html">Inspa</a>
         </div>

I've done the same for each navigation bar.
 
Hi all,

I have several navigation bars on my site but I would like to create a once clicked dependent on the page that it is on to match the navigation bar's hover style. Illustration of the styles I have on hover are below.
I'm not sure I understand what you mean. Could you explain more clearly?

You have a different navigation bar on each page, and each navigation bar should have a different hover style? Is that correct?
 
I'm not sure I understand what you mean. Could you explain more clearly?

You have a different navigation bar on each page, and each navigation bar should have a different hover style? Is that correct?
Pretty much, yeah.
 

Attachments

  • Screenshot 2024-06-29 at 21.47.19.png
    Screenshot 2024-06-29 at 21.47.19.png
    143.5 KB · Views: 5
  • Screenshot 2024-06-29 at 21.47.08.png
    Screenshot 2024-06-29 at 21.47.08.png
    693.6 KB · Views: 4
  • Screenshot 2024-06-29 at 21.46.59.png
    Screenshot 2024-06-29 at 21.46.59.png
    161.5 KB · Views: 4
  • Screenshot 2024-06-29 at 21.47.43.png
    Screenshot 2024-06-29 at 21.47.43.png
    827.5 KB · Views: 4
  • Screenshot 2024-06-29 at 21.47.34.png
    Screenshot 2024-06-29 at 21.47.34.png
    339.5 KB · Views: 3
Then I don't get what the problem is. You seem to have different navigation bars, each with different hover styles. Is that not what you wanted?
So once clicked styles and hover styles yes. So far, I have added these into the html body of the various pages with a <style> tag but am wondering if there is a better way of doing things for each individual style rather than writing quite a lengthy style for both the navigation bar and footer, e.g.
HTML:
 <a href="cv.html" style="font-size: 2.3dvw; font-family: Montserrat ExtraBold; font-weight: 900;">CV</a>
 <div class="column"><a href="cv.html" style="font-family: Montserrat ExtraBold; font-weight: 900;"><p>CV</p></a></div>
The real one I'm having a problem with at the moment is the black navigation bar which because of the hover effect and the position of the attribute tag means it isn't flush with it's neighbour attribute.
 
So far, I have added these into the html body of the various pages with a <style> tag but am wondering if there is a better way of doing things for each individual style rather than writing quite a lengthy style for both the navigation bar and footer, e.g.
So you already have all the styles you want, but are just wondering if there's a better way to do it?
 

Buy us a coffee!

Buy me a coffee.
Back
Top Bottom