0

Problem with a <a> floating element

I'm triying to float an img, also this img is a <a> element, but when I float it, this loses the ability to be a link when the pointer is passed, example: HTML <div id="text"><p>Some text</p></div> <div id="link"><a href="#"><img src="#"/></a></div> CSS #text{ float: left; } Thank you

24th Sep 2018, 11:11 PM
Christian Mora
Christian Mora - avatar
6 Antworten
+ 3
Can you drop the whole code into the Code Playground (and provide the link here) so we can reproduce the issue? The Code Playground should be relatively easy to find in the website version of SoloLearn, but if you are in the app version, it can be accessed via the curly braces, green circle with plus sign to add a new project, then select the project type. Looking forward.
25th Sep 2018, 1:07 AM
Janning⭐
Janning⭐ - avatar
+ 2
The hashtag by itself in the href attribute of an anchor element basically says, "when this anchor is clicked, jump to the top of the page". I think you stumbled upon it by accident perhaps. At the moment, your float property is only being applied to the div with the "text" id, which is a block level element, so you won't be able to see the float working. I think these are two separate problems.
25th Sep 2018, 12:44 AM
Janning⭐
Janning⭐ - avatar
+ 1
Hello, I already managed to solve the problem, it was due to an element with an absolute positioning in the previous article to the new one that I was creating, as the parent container did not have a fixed positioning, the element that was positioned as absolute was based on the body tag , affecting everything. Thank you very much.
25th Sep 2018, 3:30 AM
Christian Mora
Christian Mora - avatar
+ 1
Good job! 👍 and thank you for following up with us. 😊
25th Sep 2018, 3:35 AM
Janning⭐
Janning⭐ - avatar
0
Sorry, the "#" is only to put something, I know in the href="http://somedirection.com/ and in the src=someimage.jpg or whatever. What I say is, rhe img I put is totally a link, but when I put the text to float, the img goes to the right of the text, them if you pass the pointer on a computer, only half of the img is link, the other half cannot be selected by the pointer, although the img is totally displayed.
25th Sep 2018, 12:53 AM
Christian Mora
Christian Mora - avatar