How to set a active link as default when page first time load

css, html, hyperlink

Solution

If you can change your markup to this:

<div>
<!--I want this first link to be set as active by default-->
<a href="#" id="focusmeplease"/>
<!--I want this one as normal-->
<a href="#"/>
</div>

Then you can use this JavaScript:

document.getElementById('focusmeplease').focus();

Attach that JavaScript to page load however you like (I like this way, unless you're using jQuery, in which case use `$(document).ready()`).

Problem

I need some help to set a link as active as default when the page load the first time. ``` <style type="text/css"> a{ color:black; } a:hover{ color:white; } a:active{ color:blue; } </style> <div> <!--I want this fisrt link to be set as active by default--> <a href="#"/> <!--I want this one as normal--> <a href="#"/> </div> ```

Original source