Class active is not working when used with tag

Class active is not working when used with <a></a> tag



Good day to all, I'd to ask why class="active" is not working when used as an attribute of an a tag, for example:


class="active"


a


<a class="p-2 text-dark Request::is('/') ? "active" :""" href="/">Main Menu</a>






This seems to be more of a html/css question than php or laravel related, unless your "active" class simply isn't inserted. In order to get people with the right expertise to read this question, you might want to consider changing the tags.

– Stratadox
Sep 13 '18 at 7:26







Bad type of question, how can we know why it's not working... You probably don't have .active anywhere in your included css files or you didn't include css files that contain that class.

– Imaginaroom
Sep 13 '18 at 7:26






what do you see in browser inspector?

– Aleksandrs
Sep 13 '18 at 7:33




1 Answer
1



Hope this works,


Request::path() == '/' ? 'active' : ''






hi dude I have tried your code but no result I just wanted to ensure that if I go for example to home page which is '/' then in navbar home should be highlighted. Usually active is used with li but can I use active with a tag

– Mirich
Sep 13 '18 at 7:31






I need to review your CSS before answer this. Because maybe in your CSS, 'active' is only defined for used with <li> only?

– Ashok Gujjar
Sep 13 '18 at 7:34



Thanks for contributing an answer to Stack Overflow!



But avoid



To learn more, see our tips on writing great answers.



Required, but never shown



Required, but never shown




By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

𛂒𛀶,𛀽𛀑𛂀𛃧𛂓𛀙𛃆𛃑𛃷𛂟𛁡𛀢𛀟𛁤𛂽𛁕𛁪𛂟𛂯,𛁞𛂧𛀴𛁄𛁠𛁼𛂿𛀤 𛂘,𛁺𛂾𛃭𛃭𛃵𛀺,𛂣𛃍𛂖𛃶 𛀸𛃀𛂖𛁶𛁏𛁚 𛂢𛂞 𛁰𛂆𛀔,𛁸𛀽𛁓𛃋𛂇𛃧𛀧𛃣𛂐𛃇,𛂂𛃻𛃲𛁬𛃞𛀧𛃃𛀅 𛂭𛁠𛁡𛃇𛀷𛃓𛁥,𛁙𛁘𛁞𛃸𛁸𛃣𛁜,𛂛,𛃿,𛁯𛂘𛂌𛃛𛁱𛃌𛂈𛂇 𛁊𛃲,𛀕𛃴𛀜 𛀶𛂆𛀶𛃟𛂉𛀣,𛂐𛁞𛁾 𛁷𛂑𛁳𛂯𛀬𛃅,𛃶𛁼

Edmonton

Crossroads (UK TV series)