How to give links to a button common in all pages using external css ? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

How to give links to a button common in all pages using external css ?

I have multiple html pages and each page have some common buttons .. I want to declare a link for button in external CSS. so that I don't need to give links to each page separately.. any one know how to use CSS in this case .. Thanks in advance..

4th Dec 2016, 3:55 AM
Jithin Sathianandan
Jithin Sathianandan - avatar
2 Answers
+ 3
You should use JavaScript for that, not CSS. <script> //when the HTML charged window.onload = function() { //get an array with all the buttons var butArray = document.getElementsByTagName('button'); //loop all the arrays position for(var i=0;i<butArray.length;i++) //assign the function to open the new link butArray[i].onclick = function () { window.open("example.com"); } }; </script>
4th Dec 2016, 4:48 AM
Nahuel
Nahuel - avatar
0
you should learn php for that so you can include html on all pages
13th Dec 2016, 4:22 PM
Dennis Raangs
Dennis Raangs - avatar