Newbie problem with css - Struggling to position link in top right corner

I want to have a link appear on the top right corner that opens a new tab with another page. Although the tab and page open correctly, the link remains stuck in the top left corner.

Despite trying various solutions from Stackoverflow, nothing seems to be working for me. It must be something simple that I am overlooking...

/**CSS (from stackoverflow answer**/

a.right-link {
  color: #2da1c1;
  font-size: small;
  text-decoration: none;
  float: right;
}

a.right-link:hover {
  color: #f90;
  text-decoration: underline;
}

.leden-form {
  width: 200px;
  clear: both;
}

.leden-form input {
  width: 100%;
  clear: both;
}

label,
input {
  display: block;
}

label {
  margin-bottom: 10px;
}

table {
  font-family: arial, sans-serif;
  border-collapse: collapse;
  width: 100%;
}

td,
th {
  border: 1px solid #dddddd;
  text-align: left;
  padding: 8px;
}

tr:nth-child(even) {
  background-color: #dddddd;
}
<div>
  <a class='right-link' href='postcodes.php' target='blank'>Postcodes toevoegen/verwijderen</a>
</div>

I have attempted to remove the 'a' element and use only the 'right-link' class name, as well as putting the class name in the div element of the link. However, neither solution has worked.

What could I be missing here, and how can I make it work?

View image of link on the page

Answer №1

.align-right {
  text-align: right;
}

a.link-to-right {
  color: #2da1c1;
  font-size: small;
  text-decoration: none;
  display: inline-block;
}

a.link-to-right:hover {
  color: #f90;
  text-decoration: underline;
}
<div class="align-right">
  <a class='link-to-right' href='post-codes.php' target='blank'>
         Add/Remove Postcodes
        </a>
</div>

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

What steps should I take to properly align these product cards in a grid layout?

I have a grid of items where the first three are perfectly aligned, but the subsequent ones are scattered throughout the webpage. Please see here for an example. I would like to align all cards in the grid similar to the first three. Any help with this wou ...

`In HTML, trigger blocks based on the number chosen by the user`

I am working on creating a web page where users can select the number of friends they have, and based on that input, a corresponding number of invisible boxes will be triggered. For example, if a user selects 3 friends, 3 boxes will appear for them to ente ...

Trouble with achieving equal height columns in nested flexbox layout on Google Chrome

I am looking to evenly space several sidebar blocks throughout a lengthy post. To achieve this, I have utilized Flexbox within the sidebar for handling the even distribution of the blocks and it has been working flawlessly. Check out Code Pen: http://cod ...

unitary incline division assemblage

I noticed a particular element in the design that is currently displayed with an image (png). However, I am facing limitations due to needing to make it adaptive. Can a gradient be used as a sub-element instead? background-image: linear-gradient(to left, ...

Removing sort icon from the first column of a DataTable using jQuery

Is there a way to completely disable the sorting property in the dataTable API? I tried using bsort:false to disable sorting in all columns, which works fine, but the first column still displays the sort icon. Why is that? $("#reportgrid").DataTable({ ...

The jQuery.slide() function is causing dynamic changes in the table columns

I have a unique situation with a table where some data is initially hidden and can be expanded by clicking a button. I am implementing the technique outlined here. Here is the HTML markup I am using: <button class="toggleBtn">Hide/Show</ ...

Tips for troubleshooting objects within an Angular template in an HTML file

When I'm creating a template, I embed some Angular code within my HTML elements: <button id="btnMainMenu" class="button button-icon fa fa-chevron-left header-icon" ng-if="(!CoursesVm.showcheckboxes || (CoursesVm.tabSelected == 'curren ...

Trouble with Showing Bootstrap 5 Icon

My current project involves creating a website using Bootstrap 5 icons, but I'm encountering an issue where the icon is not displaying correctly. The expected appearance should be like this [![Example1][1]][1], but it actually looks like this [![Examp ...

Sometimes Google Maps API doesn't load properly on my page until I hit the refresh button

Occasionally, I encounter a problem where my Google Map fails to load when the webpage is first opened, resulting in a blank map. However, upon refreshing the page, the map loads correctly. The error message appearing in the Chrome console reads as follow ...

I am looking to enhance my CSS menu by incorporating a sub menu feature

I am having trouble getting my submenu to slide to the right horizontally. I have tried various CSS menus, but they are causing issues with my webpage. Here is the HTML code for the menu: <li class="widget"> <h2>Categories</h2> & ...

Tips for adjusting the height of the NextJS Image tag based on the width of the screen

I'm leveraging next/image to display my image in the following way: <Image src={imageLink} width="1920" height="512" alt="Hero Image" /> Everything works well for screen widths larger than 750px. Is there ...

Issue with triggering the change event for <select> tag

Whenever the selected value of the drop down changes, the following code does not work as expected. Please make corrections if any errors are present. <!doctype html> <html lang="en"> <head> <meta charset="utf-8</scri ...

Using JavaScript to create CSS animations triggered on hover

Looking for a CSS Animation that will play forward once when the mouse enters a specific div, and then play in reverse when the mouse leaves. Check out my JsFiddle here. The div with the class ".item" should trigger the mouse enter event. The animation co ...

Viewing at full width on mobile exceeds 100% [React]

I'm attempting to make a div cover exactly 100% of the width on mobile devices, but no more. The code I'm using is as follows: Here is my React code: <div className="max-width-100vw"> HELLO I AM A UNIQUE SENTENCE HERE??? </div> And ...

Scaled-down navigation when scrolling

Is there a way to make the navigation bar shrink when scrolling, similar to how it functions on this website? The transition on this site is so seamless. I'm guessing it's achieved with JQuery. ...

Using JQuery to automatically scroll and anchor to the bottom of a dynamically populated div, but only if the user doesn't

I am attempting to achieve the functionality of automatically scrolling to the bottom of a div with the ID #chat-feed. The overflow for this div is set to auto, and I want it to remain at the bottom unless a user manually scrolls up. If they do scroll up, ...

Problem with Bootstrap 5 dropdown menu: Functional on main page, but failing on subpages

As a beginner with Bootstrap, I recently attempted to integrate a dropdown menu into my website by following the Bootstrap documentation (version 5.1) for guidance. While the dropdown menu functions correctly on the homepage, it fails to work properly on ...

Using HTML, jQuery, and JSON with an AJAX call to populate two web tables stacked on top of each other

I am encountering an issue with populating two tables using two searches based on user input in mySQL-JSON-AJAX. When the user enters a search term and clicks the corresponding button, data should populate the respective table. The problem arises when clic ...

Issue with implementing LocomotiveScroll on a sticky element

Working on a personal project, I have been experimenting with Nextjs and locomotive-scroll. I am attempting to use position:sticky; along with data-scroll-sticky, but unfortunately the desired functionality is not working as expected. Here is the code snip ...

HTML - Image is only partially visible

While attempting to set up this theme for my blog, I encountered a minor issue - the avatars in the comment section are not displaying correctly, as they appear to be cut off along with the container. Despite numerous attempts to edit the code, I have be ...