[html] CSS Pseudo-classes with inline styles

Is it possible to have pseudo-classes using inline styles?


Example:

<a href="http://www.google.com" style="hover:text-decoration:none;">Google</a>

I know the above HTML won't work but is there something similar that will?

P.S. I know I should use an external style sheet, and I do. I was just curious if this could be done using inline styles.

This question is related to html css css-selectors pseudo-class inline-styles

The answer is


Not CSS, but inline:

<a href="#" 
   onmouseover = "this.style.textDecoration = 'none'"
   onmouseout  = "this.style.textDecoration = 'underline'">Hello</a>

See example →


You could try https://hacss.io:

<a href="http://www.google.com" class=":hover{text-decoration:none;}">Google</a>

Demo


Rather than needing inline you could use Internal CSS

<a href="http://www.google.com" style="hover:text-decoration:none;">Google</a>

You could have:

<a href="http://www.google.com" id="gLink">Google</a>
<style>
  #gLink:hover {
     text-decoration: none;
  }
</style>

or you can simply try this in inline css

<textarea style="::placeholder{color:white}"/>

Examples related to html

Embed ruby within URL : Middleman Blog Please help me convert this script to a simple image slider Generating a list of pages (not posts) without the index file Why there is this "clear" class before footer? Is it possible to change the content HTML5 alert messages? Getting all files in directory with ajax DevTools failed to load SourceMap: Could not load content for chrome-extension How to set width of mat-table column in angular? How to open a link in new tab using angular? ERROR Error: Uncaught (in promise), Cannot match any routes. URL Segment

Examples related to css

need to add a class to an element Using Lato fonts in my css (@font-face) Please help me convert this script to a simple image slider Why there is this "clear" class before footer? How to set width of mat-table column in angular? Center content vertically on Vuetify bootstrap 4 file input doesn't show the file name Bootstrap 4: responsive sidebar menu to top navbar Stylesheet not loaded because of MIME-type Force flex item to span full row width

Examples related to css-selectors

Angular 2: How to style host element of the component? How to click a href link using Selenium How do I apply a style to all children of an element How to write a CSS hack for IE 11? :last-child not working as expected? Need to find element in selenium by css jQuery select child element by class with unknown path How do I select an element that has a certain class? What is the difference between cssSelector & Xpath and which is better with respect to performance for cross browser testing? What is the mouse down selector in CSS?

Examples related to pseudo-class

How to position a CSS triangle using ::after? Indent starting from the second line of a paragraph with CSS Css pseudo classes input:not(disabled)not:[type="submit"]:focus CSS3 :unchecked pseudo-class CSS :selected pseudo class similar to :checked, but for <select> elements How to write :hover condition for a:before and a:after? CSS Pseudo-classes with inline styles How to select the first, second, or third element with a given class name? What is the difference between :focus and :active? Setting CSS pseudo-class rules from JavaScript

Examples related to inline-styles

React.js inline style best practices Using CSS :before and :after pseudo-elements with inline CSS? CSS Pseudo-classes with inline styles How to write a:hover in inline CSS?