Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!
  • Guest, before posting your code please take these rules into consideration:
    • It is required to use our BBCode feature to display your code. While within the editor click < / > or >_ and place your code within the BB Code prompt. This helps others with finding a solution by making it easier to read and easier to copy.
    • You can also use markdown to share your code. When using markdown your code will be automatically converted to BBCode. For help with markdown check out the markdown guide.
    • Don't share a wall of code. All we want is the problem area, the code related to your issue.


    To learn more about how to use our BBCode feature, please click here.

    Thank you, Code Forum.

HTML & CSS Fixing a hyperlink to the bottom of a div element. Looking for help!

Malcolm

Administrator
Administrator
Staff Team
Code Plus
Company Plus
Hi all,

I want to position a hyperlink at the bottom of my div container (similar to vertical-align: text-bottom), but wasn't able to achieve this. Should I use the position property or create another div and place my hyperlink within that div?

Would love to hear your ideas!
 
You could do something like that:
CSS:
div a{
  position: absolute;
  bottom: 10px;
}
The <a> element will be placed at 10px from the bottom of its parent.

Oh... Just saw you said:
Should I use the position property or[...]
Sorry :sleep:.

Do giving the style
CSS:
margin-top: auto;
to the <a> element does the job?
 
You could do something like that:
CSS:
div a{
  position: absolute;
  bottom: 10px;
}
The <a> element will be placed at 10px from the bottom of its parent.

Oh... Just saw you said:

Sorry :sleep:.

Do giving the style
CSS:
margin-top: auto;
to the <a> element does the job?
I'll try it, I was trying to avoid position: absolute as much as possible because I found it to be a little bit of pain while dealing with mobile devices. But I can play around with it.

Could you explain what margin-top: auto would do?
 

New Threads

Latest posts

Buy us a coffee!

Back
Top Bottom