I want to make the entirety of the red border divs a link. I thought I could just move the opening a tag before the div but that messed it up entirely.
Hello, can you clarify on what you meant to by “messed it up entirely”? I tried the approach you did and moved the opening a tag before the begining of the div (the div with the p1 id) and then moved the closing a tag to after the end of that div. I did the same for divs with ids p2, p3 … It seemed to work. Did you perhaps mean another div ?
And as for the easiest way to make a div a link it is to wrap the div in anchor tags (a tags) the way you tried.
That is weird. I did the same thing and got it right: https://codepen.io/peter-parker-the-selector/full/JjNRvwq . Maybe you wrapped the a tag around the wrong div tag ? I copy pasted your code and the only change I made was moving opening a tag before opening div tag and moving the closing a tag to after the closing div tag … I don’t think that browsers should matter since we both did it in codepen but I’m not sure. I use a Chrome browser. Have you tried other browsers ?
it is illegal for a div to be a child of an a element, how the browser will deal with it depends on browser implementation, broken html can appear differently on different browsers
you can use an html validator to validate your code The W3C Markup Validation Service
I did wrap an a tag around a div tag in my portfolio page website and the validation service does not show an error or a warning.
sorry, my mistake, it seems I have not clear when it is not valid to do
type or paste code here
Please put "Tribute page" and then img tag inside a_tag's content field .
This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.