I’m working on a nav bar, and want to have an image before the linked text, but when I rotate and translate the image to look the way I want it, it covers the text. Is there a way to make it be in that location and that rotation and be in line with the text, am I doing too much or doing something wrong? Output image added.
Code:
<tr>
<td>
<img src="massets/pencil.gif" id="pencil";><a href="about.html">about me</a>
</td>
</tr>
CSS:
#pencil{
transform: translate(10px, 10px) rotate(90deg);
}
3
Answers
I made some changes to the CSS you provided.
I added margin-left and some styling.
The problem was happening because there wasn’t enough space between the image and the link.
The problem is your use of transform rotate. I’m assuming your height of your icon is larger than the icons width?
This is what causes the text to not adjust accordingly because the transform property will not change the "physical" space of the image and it’s placement. This is whats causing the overlapping.
To solve this you could try to wrap the image in a div and set the width of the div to the same width as ur icons height.
In the example I used a div with fixed size in px to simulate ur icon (img element)
Details are commented in example below.