Html trouble aligning to right bottom of page - html

hi i have a problem my code looks like this(I'm a starter)
<div class="backtotop">
<a href="#top">
Back to topˆ
</a>
</div>
and my stylesheet has
.backtotop{
font-size: 30px;
width: 20%;
background-color: #b6aeac;
text-align: right bottom;
}
a{
text-decoration: none;
font-size:30px;
font-style: normal;
color: #23285a;
}
but it doesnt align
I want to show it at the bottom right of page but i dont want it to be fixed. The picture of absolute code used
Its back to top bottom I'm making

.backtotop {
font-size: 30px;
width: 20%;
background-color: #b6aeac;
position: fixed;
bottom: 0; // adjust as per need
right: 0; // adjust as per need
}

Use this Code for bottom right at page in css of
position: fixed;
bottom: 0;
right: 0;
Check the snippest:
.backtotop{
font-size: 30px;
width: 20%;
background-color: #b6aeac;
position: fixed;
bottom: 0;
right: 0;
}
a{
text-decoration: none;
font-size:30px;
font-style: normal;
color: #23285a;
}
<div class="backtotop">
<a href="#top">
Back to topˆ
</a>
</div>
UPDATED :
Checkout This By using position:absolute
.backtotop{
font-size: 30px;
width: 20%;
background-color: #b6aeac;
position: absolute;
right: 0;
bottom: 0;
}
a{
text-decoration: none;
font-size:30px;
font-style: normal;
color: #23285a;
}
<div class="backtotop">
<a href="#top">
Back to topˆ
</a>
</div>
UPDATED 2 :
If You want to div at center then remove bottom:0 and add top:50%;
Like This :
.backtotop{
font-size: 30px;
width: 20%;
background-color: #b6aeac;
position: absolute;
right: 0;
top:50%;
//bottom: 0;
}
And If it is fixed that you want to display BacktoTop Class Exactly Right To the Name Of Institute then simply align the div at right or if you use table structure then text-align:right in last .
My Be This will Helpful To You.
Still Ask If You Have Any Doubt.

Related

How to make a fixed position navbar with equal spacing?

I already found out that display and position cannot both be used at the same time, but can't seem to find another solution. My code right now shows the navbar how I want it but I can't find a way to fix the position so it stays when scrolling. Thanks!
.navbar {
top: 0;
left: 0;
text-align: justify;
border: dotted blue;
font-family: Arial, Helvetica, sans-serif;
font-size: 2em;
}
.navbar a {
text-decoration: none;
}
.navbar a:hover {
background: #ddd;
color: black;
}
.navbar:after {
content: '';
width: 100%;
/* Ensures there are at least 2 lines of text, so justification works */
display: inline-block;
}
<div class="navbar">
<a id="home" href="#home">home</a>
<a id="projects" href="#projects">projects</a>
<a id="shop" href="#shop">shop</a>
<a id="about" href="#about">about</a>
<a id="contact" href="#contact">contact</a>
</div>
tried out before and after elements and also to put the whole thing in another div but can't make it work
Edit: have another quick question: is there a quick fix to change the fact that I can highlight the long space between the navigation links?
.navbar {
position: fixed;
top: 0;
left: 0;
right: 0;
height: 50px;
display: flex;
justify-content: space-between;
align-items: center;
}
To fix the position of your .navbar when scrolling, you can use position: fixed; and right: 0;
.navbar {
position: fixed;
top: 0;
left: 0;
right: 0;
text-align: justify;
border: dotted blue;
font-family: Arial, Helvetica, sans-serif;
font-size: 2em;
}
Apply this CSS rule:
.navbar {
position: fixed;
top: left: 0;
right: 0;
text-align: justify;
border: dotted blue;
font-family: Arial, Helvetica, sans-serif;
font-size: 2em;
}

I am trying to make this div move with me when I scroll down but its not working, when I use position: fixed or position: sticky it doesn't work

I have this div on my home page and want it to move with me when I scroll:
I tried using position:sticky; and position: fixed and adding top: 600px; but its not moving to the top its stuck at the bottom
.linkss {
color: #8892b0;
font-family: 'NTR', sans-serif;
font-size: 25px;
right: 10px;
top: 680px;
padding-right: 30px;
position: fixed;
}
.linkss h3 {
margin: 0px;
height: 50px;
color: #c9c1f5;
}
.linkss a {
border: 0px;
display: block;
padding: 0px;
margin: 0px;
font-size: 23px;
padding-left: 30px;
color: #c9c1f5;
height: 30px;
width: 110px;
}
<div className="linkss">
<h3>/ Links</h3>
/ Etsy Shop
/ LinkedIn
/ Instagram
</div>
The HTML should be "class" instead of "className"
<div class="linkss">
I tested your CSS after updating the HTML and the menu stayed fixed for me.
I think you can try position sticky.
.linkss {
position: sticky;
top: 0;
}

How can i stick the footer to the bottom?

How can I stick this footer to the bottom of the page:
<footer>
<p>This is a Footer, Copyright © © 2017</p>
</footer>
https://jsfiddle.net/1d9m2frt/2/
footer {
text-align: center;
background-color: #e8491d;
color: #ffffff;
padding: 20px;
margin-top: 20px;
}
I tried position: fixed; but it doesn't stay fixed on the bottom of the page.
footer {
text-align: center;
background-color: #e8491d;
color: #ffffff;
padding: 20px;
margin-top: 20px;
position:fixed;
width:100%;
bottom:0;
left:0;
right:0;
}
thats all...
There's a few different ways to do this, you can in fact use position: fixed;
When using position: fixed; you will need to specify the position using top: ; right: ; bottom: ; or left: ; attributes. For maximum browser compatibility use both top/bottom and left/right. IE doesn't like you using only one of them.
In this instance you will also need to specify width: ;
Amend your JSFiddle CSS as below:
footer {
text-align: center;
background-color: #e8491d;
color: #ffffff;
padding: 20px;
margin-top: 20px;
position: fixed;
bottom: 0;
left: 0;
width: 100%;
}

Html and css. My div class doesn't react to css

I created a div class and called it .center in CSS. When doing all the styling it doesn't react when shown in browser. I made the exact same thing with the same code when creating the home page. However when I do the same thing for the second page nothing happens.
.center {
position: absolute;
left: -25%;
top: 85%;
width: 100%;
text-align: center;
font-size: 18px;
font-family: 'Anton', sans-serif;
color: white;
}
<div style="cursor:pointer; position: absolute; width: 59px; height: 42px; left: 687px; top: 29px;" onclick="openNav()">
<div class="fa fa-angle-double-down" style="font-size:50px; color:white; hover: black;"></div>
<div class="center">Menu</div>
</div>
I have the same attributes for the homepage and the menu text is white with the font family and have the hover effect. However on this page it doesn't react to the CSS it's just plain black with standard font.
Your div.center is positioned absolutely in relation to its parent. Do this:
.center {
position: absolute;
margin-left: auto;
margin-right: auto;
left: 0;
right: 0;
text-align: center;
font-size: 18px;
font-family: 'Anton', sans-serif;
color: #FFF;
}

Div Attached to side of wrapper

I am trying to add a div to the side of my wrapper. It will be a link / button.
I want it to be able to slide up and down, fixed to the right hand side border when scrolling.
The button is:
#booknow {
position: absolute;
right: 0;
margin-left:25px;
text-align:center;
font-family: 'Raleway',sans-serif;
font-size:22px;
color:#ffffff!important;
font-weight:700;
line-height:26px!important;
text-transform:uppercase;
}
And the inner wrapper (Where the border is), is:
.wrapper_inner{
position:relative;
z-index:10!important;
padding:30px!important;
background:#fff!important;
border:1px solid #D4D4D4!important; }
HTML:
<div class="wrapper">
<div class="wrapper_inner">
<div id="booknow">
Book <br> Now
</div>
</div>
</div>
At the minute I have this:
If I set it to fixed it slides up and down but it won't position perfectly to the outside of .wrapper_inner.
The HTML wasn't that helpful, so I just threw something together. The color scheme is to display the elements. I removed .inner_wrapper and added the surrounding layout so it would be possible to demonstrate that #booknow floats. If you click the #booknow it'll scroll down to a faux form at the bottom.
Demo: https://plnkr.co/edit/qACqW4O4rJn7YHoPRWLy?p=preview
Full screen: https://run.plnkr.co/njw73AIIIuHXEooM/
Relevant CSS
body {
position: relative;
overflow-y: scroll;
overflow-x:hidden;
font: 500 16px/1.4 'Arial';
min-height: 100vh;
}
.spacer {
position: absolute;
bottom: -200px;
height: 60%;
}
#booknow {
position: fixed;
top: 30px;
right: 0;
float: right;
margin-left: 25px;
text-align: center;
font-family: 'Raleway', sans-serif;
font-size: 22px;
color: #ffffff;
font-weight: 700;
line-height: 26px;
font-variant: small-caps;
z-index: 10;
background: #fc3;
padding: 10px;
width: 50px;
}
.wrapper {
position: absolute;
top: -110px;
margin: 25px;
padding: 5px 10px;
width: 100%;
border: 3px double grey;
min-height: 70px;
background: #eff999;
}