I am trying to figure it out how to put an svg/png logo at the top corner behind a text like this example.
I tried to reproduce many stackoverflow threads like these(Position icon at the top right corner of a div, Put Font Awesome icon in top right corner), but I didn't solve this problem yet. I am using react and I did this for now
import React from 'react';
import { Link } from 'react-router-dom';
import styled from 'styled-components';
import { DEVICE } from '../shared/screenSizes';
import Image from './OK.png';
const ContactPage = () => {
var container = {
position: 'relative',
};
var topRight = {
position: 'absolute',
bottom: '3px',
left: '45px',
fontSize: '18px',
width: '50px',
};
return (
<div>
<div style={container}>
<div>My Text</div>
<img style={topRight} src={Image} alt="324" />
</div>
</div>
);
};
I realize 2 problems while coding.
1. I have a hard time putting the image in the background
2. I realize that I have to hardcode the horizontal position with the css attribut left depending on the length of the text
How can I fix this problem.
Thanks in advance