- Css active not working. button ) Jun 17, 2012 · This is not a hack is in the css specification, but if you left this style like that you will regret one day, because you don't have a good specificity, and any rule that you try to apply to this element for example this rule will win over a rule with the id of the element, for example "#my_input_type_text" or class selector ". This selector is different from :link, :visited and: hover selectors. Tailwind dynamic classes not working? Learn how to fix this common problem in 3 easy steps. Dec 12, 2012 · You are probably looking for focusing an active link in your menu with different color. I copied this from one page, b Why is my nav ul li:active background color not working? Asked 11 years, 6 months ago Modified 9 years ago Viewed 42k times Jan 13, 2015 · a:hover and a:active do not always do what they're supposed to. Now when I click my element change color only where it is active and after mouse Nov 11, 2014 · not sure whats wrong, but the code at the bottom of the css file should work shouldn't it? Sep 6, 2011 · The :active pseudo selector changes the appearance of a link while it is being activated (being clicked on or otherwise activated). <a> elements) if you are not rendering in Standards Mode in Internet Explorer. Jun 4, 2015 · Active property is not working in Firefox; I used this code: #selec:active{background-color:red;} The property works in Chrome, but not working in Firefox. If this is true, then simply use php to add an active class to the link or div in question Jan 27, 2018 · Along with the CSS you provided I see the green background on :active just fine, without needing !important also. g. Once the action the link starts is completed, it is no longer considered active. It sets different styles for three different states: :hover, :selected, and :active. Learn about RouterLinkActive directive in Angular for managing active routes and enhancing navigation experience in modern web apps. This only changes the Oct 2, 2018 · Pseudo classes :visited, :hover, :active not working Asked 11 years, 7 months ago Modified 6 years, 7 months ago Viewed 2k times Apr 11, 2010 · hey folks, i m working on a website currently in development. png') no-repeat 0 0; display: block; heigh Mar 21, 2014 · jquery and css active menu not working Asked 10 years, 11 months ago Modified 10 years, 11 months ago Viewed 365 times Feb 18, 2015 · I'm having trouble with "a:active" not working at all. I know that hovers don't really work on touch devices so I've tried using :focus and :active and Jul 14, 2015 · Your active rule should always be after :link, :visited, and :hover. I have used the Safari debugging tools with an iOS device plu Dec 7, 2017 · There have a simple problem with your jquery , you writhe the condition outside the click function , thats why the active class didn't added , now thats solved check with snippet run this working snippet Jun 12, 2020 · I created a button utility class for a React button component. In this video, I’ll break down the most common reasons your CSS isn’t working — and show you exactly how to I am using ionic framework with cordova platform. May 5, 2022 · The CSS !important rule can force a CSS snippet to work and act as a quick fix. For example : Code: a:active { color:#333 !important; } Ange Tuteur Foru master Posts : 13207 Reputation Learn how to fix a navbar that's not working in Bootstrap 5. Jun 20, 2015 · CSS a:active pseudo class not Working Asked 9 years, 9 months ago Modified 9 years, 9 months ago Viewed 218 times 0 To mention about a possible case not covered by the other answers, one possibility for the hover to work inconsistently in Firefox is that there is a mouseover event listener that reorders the hovered element in DOM, for example with appendChild. Contribute to dmitrizzle/active-touch development by creating an account on GitHub. 2. But on mobile devices is not working hover, focus or active. May 27, 2025 · Hover, Focus, and Other States in Tailwind CSS Tailwind CSS is a utility-first CSS framework that allows you to rapidly build custom user interfaces. button. The main use of : active selector is on the links but it can be used on all elements. button:active. A link only takes up the a:active state when it is clicked, so you only see the change for a few seconds. May 20, 2019 · I'm trying to add an active class to a button but it won't work. You did not write ul element which is parent of li element. As a workaround solution, you can use the Hover color instead of extra code. However I'd recommend to use a css/js framework like Bootstrap or Foundation, since they already bring functionalities like those in a very easy way to use. Otherwise the :hover rule can override the :active rule. so i added ul and changed your ul elements's background color so when mouse hover, white background color can display. perhaps im confused about a:active i’d like the “current page” tab (the li) to change colour completely. delete is always absolutely positioned, but the other button is initially absolutely position, but would be relatively positioned with the :active attributes. I'll post below the HTML and CSS that is setup but my active links do not show as the set active color just the normal color, the hover works fine, the correct color shows when hovering on any link and on any page. You may be wanting the focus pseudo class as that remains when the user has clicked even if they move away (until the next click somewhere). Follow our step-by-step guide to resolve this problem!---Th Mar 30, 2024 · Hello, I'm hoping someone can help figure this out. You should look for a different way for getting it done, like adding a new css class for the selected menu item from your server side script. Tailwind CSS not working? Here's why and how to fix it. This typically means when the user is clicking or tapping on the link. Perhaps :focus is what you're looking for, as that will change the background of the button to red even if the user has let go of the mouse, until the user clicks away. Jun 27, 2015 · What kind of css are you using? I’ve tested this on a windows laptop with a touch screen, android, ios, and it worked fine for me. Just like the :hover psuedo class is only applied while the mouse is hovering over the element. I'm trying to get the active class to work with my Bootstrap navbar but it's not working (I'm assuming because I've made too many CSS changes to the nav class). Since the specification is lenient about this, there might be browser implementation differences. If you want to look at my co Apr 14, 2017 · I'm trying to set the left border of the list item with Link text to red on active, and when the user clicks another list item, the previous border is set to the original and the successive list it Mar 12, 2014 · CSS not selector not working Asked 11 years, 6 months ago Modified 11 years, 6 months ago Viewed 37k times Feb 5, 2020 · NavLink active styling does not work | React Router Asked 5 years, 8 months ago Modified 3 years, 5 months ago Viewed 7k times Jul 1, 2022 · 0 button:hover and button:active in css are class and you have element. It's usually only seen for CSS :active not working (IE 10) Asked 11 years, 6 months ago Modified 10 years, 2 months ago Viewed 4k times May 8, 2019 · I tried to run your code and did some change in active and hover class. Aug 17, 2021 · When working with HTML and CSS, you may find that your CSS is not styling your HTML document even when you’ve added the CSS to your page. Sep 5, 2017 · I can check dev tools and test what the css will do if the label were :active (see screenshot below) but how would I get the label to actually be :active? The :hover state works, so I'm hoping :active can too. Aug 4, 2014 · The :active pseudo selector only applies while the link is active. my-input-text" Mar 24, 2023 · hover: active: etc. The CSS :active pseudo-class is used to select and style an element that is being activated by the user. Are you assuming that it would be the same as the CSS :active selector? I am not sure that is a safe assumption. If i download a template of the internet if i run the page, Feb 21, 2013 · I am using asp. Feb 27, 2023 · I'm pretty new to this stuff, but I'm creating a website for a project and currently I've been trying to fix my active link and nothing so far has worked. Jul 2, 2015 · Learn how to keep the :active CSS style applied to a button even after it has been clicked. Tailwind is a popular CSS framework, but it can sometimes be tricky to get working. Oct 6, 2022 · Why my animation with css : active is not working Asked 2 years, 5 months ago Modified 2 years, 5 months ago Viewed 77 times Oct 23, 2015 · Hi, I am trying to set up a simple Bootstrap menu it works fine except the Active component doesn't work. HTML: <! Jul 21, 2012 · Forums The forums ran from 2008-2020 and are now closed and viewable here as an archive. Mar 24, 2017 · So I wanted to try and make a game but I ran into a CSS problem right away. Here my tailwind. I want to change the color of the element where I click on it. Jun 8, 2025 · Let’s break down why your CSS might not be working and how you can fix it fast. Here are six fixes that you can try to make your CSS work on your HTML page. We can't tell you because we're not the browser. The pseudo classes work great with mouse clicks, but the :active pseudo class doesn't work when I try to navigate/interact with the bu Nov 20, 2015 · The :active pseduo-class will only be activated when the user has clicked on the button and hasn't let go of the click. Just after releasing your mouse button it works as :hover. net4. styles do not work when darkMode config is class and you set a dark value #10855 New issue Closed secondl1ght Feb 11, 2012 · How do I apply a hover effect on an a element, but not to an a element with the class active? a:hover(not: . Jul 15, 2012 · Active is when the link or element is actually being selected, like when you’re mouse clicking on a link. May 8, 2017 · You are adding active class on the li element and not on the a so the selector should be Nov 26, 2015 · The :active state refers to when a link is pressed, so if you press and hold your mouse button down on your menu item it should be working as expected since hover works active has the same properties. i have a problem. Remove all the importants, and use a higher specificity to apply the css. Sep 19, 2014 · After rereading your question, I think the real answer is that you can't use CSS alone to control how the elements behave on user interaction. 4 with NX Monorepo. ---more Jul 21, 2012 · The :active CSS pseudo class works on all elements however it only works on links (e. js const { createGlobPatte Mar 20, 2015 · I want to apply some css for inputs elements and I want to do that only for inputs that are not disabled and are not submit type, below css is not working, maybe if someone can explain me how this Oct 10, 2017 · You need the class active to move to the relevant li for each page. The demo by @Engineer showed me that your code works in Chrome. With this guide, you'll be able to get your navbar working properly in no time! – Pete TNT Feb 3, 2016 at 6:48 7 its not working for me, its getting added but in next second its going to initial active class so it's not staying on the page please anyone help on this – sourav78611 Sep 21, 2016 at 5:54 16 Aug 29, 2022 · The :active CSS pseudo-class represents an element (such as a button) that is being activated by the user. "active"). Style display when the user clicks on the link. If you don't want to read up on specificity or cascade then just put the active hover snippet below the normal hover snippet. Oct 24, 2018 · Hey fellow campers, I have come across a problem with CSS hover pseudo-class, the element with hover applied would remain in hover state unless I touch somewhere else on the screen. On mobile devices I need when someone click on this card, card make hover, focus or active. This comprehensive guide covers all the common causes of navbar problems, and provides step-by-step instructions on how to fix them. Apr 9, 2014 · I have a transition happening on a div with a hover state. You can add the class button to your button or change the style to button ( and not . How can I get this to trigger? Example code: <sty Using utilities to style elements on hover, focus, and more. A solution for :active CSS problem on iOS devices. Works on all desktop browsers and android browsers. I tried to create multiple pages and link css but it simply doesn't apply. I realize that this won't work because the styles are applied immediately, and elements in the DOM are typically not :active by default: li { font-weight: bold; } li:not(:active) { font-weight: normal; } Plus, :not() is a CSS3 pseudo-class, so support Jan 4, 2022 · CSS Active link not working Asked by Charley Page on 2022-01-04 Sep 28, 2016 · I tried using :focus CSS pseudo-class in my project. Aug 23, 2019 · I am using the active pseudo class for a button and it's not working in iOS only. You should make the definition as a:active or . I am also using W3school spaces. activated{ background: #00B2EE; } CodePen Sep 2, 2023 · This CSS code snippet targets the blurb button with the ID #blurb-hover. A link becomes activated when the user clicks on it, the same goes for a button. Nov 29, 2013 · I am quite confused here, the a:active is not working , but the :hover is working fine, I have tried a lot of things but this ones is got me stuck, and is really confusing. In your example, your button. first is that my a:active property isn’t working and secondly that the i have a div for Jul 14, 2012 · So it does not state that it should not work on your div. from the expert community at Experts Exchange Mar 2, 2014 · Your css port button:active just works for the active state of button tag. I think what you really want here is an active class that you add to the tabs when they are selected, and remove when they are not. When using a mouse, "activation" typically starts when the user presses down the primary mouse button. The :active psuedo class is only applied while the button is being interacted with (i. The a:active pseudo-class in CSS is used to style an anchor element when it is being activated by the user. Button span { background: transparent url ('images/form_sprite. Syntax: :active{ //CSS property } Example: In this example, The CSS: active pseudo-class targets the active state of Aug 26, 2020 · Handheld media type doesn’t work. Aug 29, 2024 · The: active selector is used in styling an active link of the web page. Dec 10, 2012 · I'd say it looks like the problem is that the active selector doesn't work if it changes the positioning of an element. Aug 13, 2025 · Styles defined by the :active pseudo-class will be overridden by any subsequent link-related pseudo-class (:link, :hover, or :visited) that has at least equal specificity. That means there's no way to do this only with css. The :active pseudo-class is most used on <a> and <button> elements. Jul 22, 2012 · I use hover, active and disabled to style Buttons. config. active) Seems something is missing. Jul 15, 2009 · thanks, made those changes but it doesn’t work like I intend. Oct 17, 2016 · I am working on a navigation bar Active color on my navigation bar is not working. But so far you can not rely on media queries to probe for touch or hover support, you need to use JavaScript. Meaning, when I load the page into a browser, I can click on the various links in my menu and the browser will take me there, but the "Active" display doesn't change. I am using version ^3. But the problem is when the button is disabled the hover and active styles still applies. 0 and trying to create a menu bar through the use of CSS, When i am running the program the hove and the click work but the active code doesnt any idea why this is happening May 15, 2011 · Find answers to Active Button not working CSS. As you can tell by the question, the pseudo-classes that I am trying to use are not working. Writing CSS, refreshing the page, and nothing changes? We’ve all been there. A link with :active will not remain that way when your on the page it links too, it reverts back to a normal link. You can do it manually or programmatically. button:active, a:active{ background-image: -webkit-gradient( linear, left top, left bottom, color-stop(0, #2E9185), color-stop(1, #00FFE6) ); a:active selects <a> s being clicked, not clicked. custom-active. Hover is working fine but not the active. the site is working again, would you mind looking again? Sep 10, 2015 · I dont see :active anywhere in jQuery documentation. active class to it after it is clicked and style that class Here is my code, which works perfectly in all but ie! The active simply does not fire a. tooo many damn importants! css is cascading, so the code that is lowest down the page will overwrite the code that is above it. Jan 9, 2009 · Sorry man its that free hosting, i dont want to put these examples on my 1and1 server. :active is just for mouse press not for click. How to apply hover and active only on enabled buttons? Jan 2, 2024 · Hi, im working on building a protfolio project through the freeCodeCamp youtube channel and im stuck, theres a point in the video where you have to create buttons on the menu bar that when you click on the button it changes its color to green but for some reason when I right the code in VS and open the live server the feature doesent work even thogh im doing everything right!! heres the link Mar 4, 2013 · Please help. This had previously been working, apparently and, as you can see from the screenshot, the css for an :active state had already been written. The css for active state of an element (div, button or a) works fine in browser during development/testing but not at all in android device/emulato Sep 27, 2023 · In terms of One-page scrolling settings, the Nav Menu Hover color is working as an Active color. This post will go through a few reasons why using the `!important` CSS keyword might not be working and their fixes. Working draft Media Queries 4 with hover was released in 2012 with a promise of blessed land – hover media query! So we wait:). It's free to sign up and bid on jobs. Whether you’re a beginner or experienced developer, these 10 practical solutions will help you debug CSS issues I'm trying to implement Active/Current Navigation Link so that what a user is active on a certain nav link it should be green showing they are currently on that page. However, the :selected and :active states don't apply to buttons by default, which is why the provided code is not working as expected. My problem is it's not doing Search for jobs related to Css active not working or hire on the world's largest freelancing marketplace with 24m+ jobs. May 24, 2021 · You do get the change to active color, but swiftly followed by the change to the hover color so not really noticable. I have just added links May 18, 2021 · So i have this weird problem that any css i write doesn't work. Feb 14, 2019 · Why not use an actual button with its active state? EDIT: I noticed you mentioned this doesn't work in IE, this is because in IE, the clickable area is behind the content you put on the parent div, for whatever reason, honestly I don't understand that very well; but fixes I have found include setting a ::before and ::after pseudo-class to the parent div, with the following properties: . Jan 30, 2023 · Hi everybody, The active state is not working for me and i think is also not working in the docs page. It is not a selector. Sep 10, 2015 · :active is working fine. css, . There is no active property defined for your a tag or button class. Provide a link we can use to test or debug your problem. My question is there a proper way to use hover for touch devices? Or should hover be used for touch devices? Any Guidance about this would be of much help! Thank you. I'm using bootstrap. We'll also provide some tips for troubleshooting other CSS problems. In when from browser i select toogle element state and click on active bro Nov 14, 2019 · I am working with TailwindCSS and am making a simple button that I want to have a shadow when hovered, then scale down when focused or active. Show your HTML, show your actual CSS. "a:hover" is working correctly on the other hand. With our step-by-step guide, you'll be back up and running in no time. Feb 15, 2013 · To solve that with just CSS tricks you'll need to use the Selector Target, first you attribute different id for the pages and put the link to that reference, then you change the style base on the ID that is being target. It's really confusing me because if I change the blue in a:hover's color: blue; to black it suddenly works. In this article, we'll walk you through the common reasons why Tailwind might not be working and how to fix them. The hover style works, but the active style does not. If it's still not taking effect, I'd recommend adding the !important flag to the properties in your :active rule. Learn how to fix the issue of the `active` class not being applied to your navigation links with simple CSS adjustments. :hover does work, but :active doesn't add any additional style. One of its core strengths lies in its ability to easily style elements based on their different states, such as hover, focus, and active. parent Nov 5, 2023 · By adding/removing a class, you can make the :active style persist after the button is clicked. If you want to apply a style to an element to signify it is the active/selected/in-use element out of a group, you need to add some sort of . Aug 20, 2019 · 3 I have simple card when I hover on it card scale. In this post, you‘ll learn step-by-step how to pull off this technique. Learn how to fix issues with CSS button effects that do not trigger after an animation completes. In Webkit on iPhone/iPad/iPod, specifying styling for an :active pseudo-class for an <a> tag doesn't trigger when you tap on the element. or should i two of them. Mind that a:active is not intended for that purpose. Is there any option how to do it? I was looking for a pure-CSS solution and :active wasn't exactly what I was looking for because an element will only be active during the click / touch, meaning the hover/active state will either be visible very briefly or, if you keep touching, your finger might cover up the element. e. Home › Forums › CSS › How to solving : CSS selector “:active” not working ? This topic is empty. For some reason the a:link visited is not working I need the background of the link to be black when visited/active and instead it reverts back to original colour - this is annoying Oct 5, 2019 · Home is supposed to be read all the time and change to a brigther red.