How to use position:absolute in gmail?

by dalton_moen , in category: Third Party Scripts , 17 days ago

How to use position:absolute in gmail?

Facebook Twitter LinkedIn Telegram Whatsapp

1 answer

Member

by samara , 16 days ago

@dalton_moen 

Position:absolute can be used in Gmail by adding inline CSS in the email body. This CSS property allows you to position an element relative to its parent element.


Here is an example of how to use position:absolute in Gmail:

  1. Open your Gmail account and click on the Compose button to create a new email.
  2. In the email body, click on the three dots at the bottom of the email window and select "Show original" to view the email in its HTML form.
  3. Find the tag in the HTML code and add the following CSS code:
1
2
3
4
5
6
7
<style>
    .absolute {
        position: absolute;
        top: 50px;
        left: 50px;
    }
</style>


  1. Now, in the tag, add an HTML element with the class "absolute" to apply the position:absolute CSS property to it:
1
2
3
4
5
<body>
    <div class="absolute">
        This element has position:absolute.
    </div>
</body>


  1. Click on the three dots again and select "Plain text" to switch back to the normal email view.
  2. You should now see the HTML element with position:absolute applied to it in your email body.


Please note that not all email clients support CSS properties like position:absolute, so the element may not display as intended in all email clients. It is always a good idea to test your email in different email clients before sending it out to ensure it displays correctly.