-1

I need help putting text on the right top corner!

I search on Google, StackOverflow and on youtube

<html>
    <a href=login.html>LogIn</a>
</html>

I'm expecting I can put that login text on the right top corner!

Zakaria Acharki
  • 66,747
  • 15
  • 75
  • 101
Joseph
  • 315
  • 2
  • 4
  • 11

3 Answers3

1

To position the link in the top right corner of the viewport, there are several approaches.

Fixed Positioning

a {
  position: fixed;
  top: 0;
  right: 0;
}
<a href=login.html>LogIn</a>

Absolute Positioning

a {
  position: absolute;
  top: 0;
  right: 0;
}
<a href=login.html>LogIn</a>

CSS Grid (overkill, yes)

body {
  display: grid;
  justify-items: end;
}
<a href=login.html>LogIn</a>

Flexbox

body {
  display: flex;
  justify-content: flex-end;
}
<a href=login.html>LogIn</a>

Table Positioning

a {
  display: table;
  margin-left: auto;
}
<a href=login.html>LogIn</a>
Andy Hoffman
  • 18,436
  • 4
  • 42
  • 61
0

Why not just use css?

a#login {
  position: fixed;
  right: 0;
  top: 0;
}
<a id="login" href=login.html>LogIn</a>
TVBZ
  • 564
  • 1
  • 4
  • 15
-1

a{
  position:fixed;
  top: 0;
  right: 0;
}
<html><a href=login.html>LogIn</a></html>

<html><div style="text-align:right"><a href=login.html>LogIn</a></div></html>
Ajay
  • 23
  • 6