Code2care : TechZone Apps & Tutorials

How to make a div tag clickable

In Html we have the Anchor tags <a> which is a clickable element, so if you have a div tag or any other tag like span or p you can make it clickable simply by wrapping it with an anchor tag. Lets see an example,

Example :

<div style="background-color:#09C;color:#fff;padding:20px;margin:20px">Div tag : Not Clickable</div>

Result :
This is my div tag : Not Clickable

Now simply wrap the above div with anchor tag, note if you have some text within your div tag and you don't want it to be underlined as in case of a hyperlink, just add textdecoration:none in the style tag.

Example :

<a href="" style="text-decoration:none">
<div style="background-color:#09C;color:#fff;padding:20px;margin:20px">This is my div tag : Clickable</div>

Result :

This is my div tag : Clickable


Posts related to html.

1. How to place two div elements next to each other

2. Align html element at the center of page vertically and horizontally

3. Remove Html head and body tags from ckeditor source

4. How to set opacity only for div background and not the text - CSS

5. How to get table td, tr or th inner content value with id or name attribute

6. Comprehensive 256 Ascii code table with Html Hex IBM Microsoft Key

7. Link in html without a underline

8. Adding Sub Headings to Bootstrap Header tags

9. How to make a div tag clickable

10. Top 15 Programming Languages to learn 2014-2015

11. Chessboard with pieces using pure HTML and CSS

12. Default speed of Marquee tag : SCROLLAMOUNT

13. How to make div or text in html unselectable using CSS

14. Add Animated Scrolling to Html Page Title Script

15. Fibonacci series from 1 to 500 table


Popular tags
x 175
x 29
x 20
x 14
x 14
x 14
x 13
x 11

1000+ C Programs     PHP Tutorial     JSON Tutorial     Swift Tutorial     India Pinocdes     About Us     Privacy Policy

Code2care © 2012-17