Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there any way to use inline styles to define a:visited link style?

Tags:

html

css

So instead doing it using css:

<style type="text/css"> a:visited {    color: red; } </style> 

Could it be done using inline code. Something like this doesn't work:

<a href="http://google.com" style='a:visited:color:red'>Google.com</a> 
like image 394
Georgy Avatar asked Jul 25 '10 15:07

Georgy


People also ask

How do you style visited links in CSS?

The :visited selector is used to select visited links. Tip: Use the :link selector to style links to unvisited pages, the :hover selector to style links when you mouse over them, and the :active selector to style links when you click on them.

What are inline styles used for?

An inline CSS is used to apply a unique style to a single HTML element. An inline CSS uses the style attribute of an HTML element.


2 Answers

You can't do this, the specification (CSS2 here) covers it briefly here:

Neither pseudo-elements nor pseudo-classes appear in the document source or document tree.

:visited along with the others modifiers are all pseudo-classes, and there was never a standard syntax setup to do what you're trying. Honestly this is the first time I've ever seen it requested, so I don't think it'll be added to the specification anytime soon...sorry that answer sucks, but it is what it is :)

like image 121
Nick Craver Avatar answered Sep 19 '22 07:09

Nick Craver


Sure you can....

<a href="https://www.yahoo.com/" target="_blank"style="text-decoration: none; border-bottom: 1px solid pink;color:pink !important;">            some link         </a> 

jfiddle

like image 29
joshpierro Avatar answered Sep 21 '22 07:09

joshpierro