Im trying to get my footer on the bottom of my page, i got the part where its on the bottom of my page, but now its overlapping with my content area called"portfolio list" this is what it looks like now:
As you can see is my footer overlapping the bottom part of my portfolio list.
CSS part:
.container {
position: relative;
width: 1000px;
margin: 0 auto;
-webkit-transition: all 1s ease;
-moz-transition: all 1s ease;
-o-transition: all 1s ease;
transition: all 1s ease;
}
#portfoliolist .portfolio {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
-o-box-sizing: border-box;
width:31%;
margin:1%;
display:none;
float:left;
overflow:hidden;
}
.portfolio-wrapper {
overflow:hidden;
position: relative !important;
background: #666;
cursor:pointer;
}
.portfolio img {
max-width:100%;
position: relative;
}
.portfolio .label {
position: absolute;
width: 100%;
height:40px;
bottom:-40px;
}
.portfolio .label-bg {
background: #121212;
width: 100%;
height:100%;
position: absolute;
top:0;
left:0;
}
.portfolio .label-text {
color:#fff;
position: relative;
z-index:500;
padding:5px 8px;
}
.portfolio .text-category {
display:block;
font-size:9px;
}
footer{
position:absolute;
bottom:0;
width:100%;
height:100px; /* Height of the footer */
background:#121212;
}
HTML:
<div id="portfoliolist">
<?php
while($query->fetch()):
echo "<a href='post.php?id=$post_id'>"?>
<div class="portfolio <?php echo $category?>" data-cat="<?php echo $category?>">
<div class="portfolio-wrapper">
<?php echo '<img src="data:image/jpeg;base64,'.base64_encode( $image ).'" />';?>
<div class="label">
<div class="label-text">
<a class="text-title"><?php echo $title?></a>
<span class="text-category"><?php echo $category?></span>
</div>
<div class="label-bg"></div>
</div>
</div>
</div>
<?php echo "</a>";
endwhile;?>
</div>
<footer>
<div class="footer-nav">
<ul>
<li>Facebook</li>
<li>Twitter</li>
<li>DeviantArt</li>
<li>Behance</li>
<li>LinkedIn</li>
</ul>
</div>
</footer>
both of these div's are in my container. I hope someone can help me out!
Try it with footer { position: relative; } like Matej Đaković said.
But it's also important, that #portfoliolist clears the float of .portfolio, otherwise #portfoliolist has no height.
#portfoliolist:after {
content: ' ';
display: block;
clear: both;
}
You should set the position for the footer: position: fixed;and set the z-index: 9999; for the remaining part of the page without the footer. That way, the footer always stays on the bottom, with the rest of the page above it. Maybe you should set the margin bottom of the portfolio as the height of the footer. That should do it I think
Also set the position: relative; for the rest of the page. Here's the quick codepen I made http://codepen.io/oroborus357/pen/qdXdBw
try to use:
footer{
position:absolute;
bottom:0;
right: 0;
left:0;
height: 125px;
background:#121212;
}
if not just add to your content (portfolio list) and set the bottom to the beginning of the footer so it will be bottom: 125px; or bottom: 126px;
{ position:absolute;
bottom:125px;
right: 0;
left:0;
}
Here is a very handy article for this type of questions.
Hope it helps!
Related
I am trying to make a simple portfolio website and I want two tags at the bottom of the screen whenever I navigate down or up the page. So for example, if I am at the top of the page it says my name with three links, "About Me", "My Work", and "Contact". If I click on "About Me" it will navigate me down the page to where I have that section. Then this is where I need help, I want "My Work" and "Contact" at the bottom for easy navigation. I have been trying to figure this out for hours now which is why I am now asking a question on here. I am new to web programming so excuse me. Here is some of my code that is relevant.
#container {
padding-top: 100vh;
width: 100%;
height: 100vh;
color: white;
}
#container div {
position: relative;
width: 100%;
height: 100%;
}
/* Styling for each indivual link (About Me, My Work, Contact) */
#container div#AboutMe {
background: white;
color: black;
font-family: Helvetica;
font-weight: lighter;
text-align: center;
font-size: 21px;
}
#AboutMe p {
padding-right: 60%;
padding-left: 10%;
padding-top: 5%;
}
.animatedButtonBody span {
cursor: pointer;
display: inline-block;
position: relative;
-webkit-transition: 0.5s;
-o-transition: 0.5s;
transition: 0.5s;
}
.animatedButtonBody span:after {
content: '\00bb';
position: absolute;
opacity: 0;
top: 0;
right: -20px;
-webkit-transition: 0.5s;
-o-transition: 0.5s;
transition: 0.5s;
}
.animatedButtonBody:hover span {
padding-right: 25px;
}
.animatedButtonBody:hover span:after {
opacity: 1;
right: 0;
}
<div id="container">
<div id="AboutMe">
<h1>About Me</h1>
<p>
This is where some text will go.
</p>
<span>My Work</span>
<span>Contact</span>
</div>
</div>
You can try position:fixed. Also you should tidy up your html elements (wrap things in div, etc.)
Example:
.nav {
height: 60px;
background-color: grey;
}
.content{
height: 500px;
background-color: lightgreen;
}
.footer{
height: 60px;
width: 100%;
background-color: black;
position: fixed;
bottom: 0px;
}
<div class = "container">
<div class = "nav">
</div>
<div class="content">
</div>
<div class = "footer">
</div>
</div>
Hope it helps
I figured out the answer to my problem. Here is what I added to my tags.
#pinButton1 {
position: absolute;
bottom: 0;
transform:translateX(-100%)
}
#pinButton2 {
position: absolute;
bottom: 0;
transform:translateX(0%)
}
<span>About Me</span>
<span>Contact</span>
Not tested, but you can try it. You need an element with "position:fixed", this way it stays on the screen when scrolling.
<style>
.float-container {
position: absolute;
bottom: 0;
}
.about-me {
position:fixed;
}
</style>
<div class="float-container>
<div class="about-me">
<p>Some Content</p>
</div>
</div>
You should check out position:fixed and position:absolute.
Link to W3Schools: HERE
You didn't clarify what does "at the bottom" mean, therefore I give 2 examples. This is how I understood your question.
If you need buttons to be always in viewport at the bottom of the screen use this example with custom values. Here you have an example how to center an item at the bottom center of the viewport.
#example{
position:fixed;
bottom:0;
left:50%;
transform:translateX(-50%)
}
If you need an item to be at the bottom of the page use
#example{
position:absolute;
bottom:0;
left:50%;
transform:translateX(-50%)
}
I am trying to create a button.
When the the mouse hovers the wrapper div (ks-wrapper), another div (ks-overlay) (that at the start is hidden) will be appeared and the based div (ks-button) hides.
Its also necessary the button not have fixed dimensions.
Any suggestions?
HTML
<div class="ks-wrapper">
<div class="ks-button">
<div class="ks-header">
Header
</div>
<div class="ks-content">
Text
</div>
</div>
<div class="ks-overlay">
"K"
</div>
</div>
CSS
.ks-wrapper {
position: relative;
float: left;
height: 85px;
width: 100%;
}
.ks-button {
position: absolute;
color: white;
width: 100%;
height: 100%;
}
.ks-header{
border-top-left-radius:10px;
border-top-right-radius:10px;
background-color:yellow;
max-height:20px;
font-size:20px;
font-weight:bold;
text-align:center;
color:black;
padding:5px;
}
.ks-content{
border-bottom-left-radius:10px;
border-bottom-right-radius:10px;
background-color:grey;
font-size:20px;
font-weight:bold;
text-align:center;
color:black;
padding:5px;
height:100%;
}
.ks-wrapper .ks-overlay {
transition: visibility 0s, opacity 0.5s ease-in-out;
position: absolute;
color: yellow;
background-color: green;
width: 97.5%;
height: 85px;
visibility: hidden;
opacity: 0;
border-radius:10px;
padding:10px;
overflow:hidden;
}
.ks-wrapper:hover .ks-overlay {
visibility: visible;
opacity: 1;
}
UPDATE
For start I want to thank you all for your fast responses to my issue.
Secondly, I would like to make myself more clear... and also to add a couple of problems that I figure them out...
1)This button its gonna used in a responsive template.
Is it possible the button not to have a fixed height, and the overlay to follow this height?
2)how can accomplish to have transition and to mouse leave (transition works only in hover)??
3)This button stays on top of the following elements
This is the link in the fiddle that represents the issues.
Thank you a lot for your time
the header is taking 20 px on the top.. you need tho add these to your .ks-wrapper .ks-overlay {
.ks-wrapper {
position: relative;
float: left;
height: 85px;
width: 100%;
}
.ks-button {
position: absolute;
color: white;
width: 100%;
height: 100%;
}
.ks-header{
border-top-left-radius:10px;
border-top-right-radius:10px;
background-color:yellow;
max-height:20px;
font-size:20px;
font-weight:bold;
text-align:center;
color:black;
padding:5px;
}
.ks-content{
border-bottom-left-radius:10px;
border-bottom-right-radius:10px;
background-color:grey;
font-size:20px;
font-weight:bold;
text-align:center;
color:black;
padding:5px;
height:100%;
}
.ks-wrapper .ks-overlay {
transition: visibility 0s, opacity 0.5s ease-in-out;
position: absolute;
color: yellow;
background-color: green;
width: 97.5%;
height: 105px;
visibility: hidden;
opacity: 0;
border-radius:10px;
padding:10px;
overflow:hidden;
}
.ks-wrapper:hover .ks-overlay {
visibility: visible;
opacity: 1;
}
<div class="ks-wrapper">
<div class="ks-button">
<div class="ks-header">
Header
</div>
<div class="ks-content">
Text
</div>
</div>
<div class="ks-overlay">
"K"
</div>
</div>
Might be you are saying about .ks-overlay which overflow browser width after certain screen size, if so then that's because of padding added in that, use css box-sizing property as below,
The box-sizing property is used to alter the default CSS box model
used to calculate width and height of the elements.
.ks-wrapper {
position: relative;
float: left;
height: 85px;
width: 100%;
}
.ks-button {
position: absolute;
color: white;
width: 100%;
height: 100%;
}
.ks-header{
border-top-left-radius:10px;
border-top-right-radius:10px;
background-color:yellow;
max-height:20px;
font-size:20px;
font-weight:bold;
text-align:center;
color:black;
padding:5px;
}
.ks-content{
border-bottom-left-radius:10px;
border-bottom-right-radius:10px;
background-color:grey;
font-size:20px;
font-weight:bold;
text-align:center;
color:black;
padding:5px;
height:100%;
}
.ks-wrapper > .ks-overlay {
transition: visibility 0s, opacity 0.5s ease-in-out;
position: absolute;
color: yellow;
background-color: green;
width: 100%;
height: 85px;
visibility: hidden;
opacity: 0;
border-radius:10px;
padding:10px;
overflow:hidden;
left:0;
box-sizing:border-box;
}
.ks-wrapper:hover .ks-overlay {
visibility: visible;
opacity: 1;
}
<div class="ks-wrapper">
<div class="ks-button">
<div class="ks-header">
Header
</div>
<div class="ks-content">
Text
</div>
</div>
<div class="ks-overlay">
"K"
</div>
</div>
Looking for some styling CSS help. I want to create an image box (that should be link) with centered text that is diplaying over the image with color half-transparent overlay background. We have such given HTML:
<div class="figure">
<a href="#" class="link1">
<img src="http://www.w3schools.com/css/klematis.jpg" alt="flower Klematis">
<div class="figcaption">Klematis</div>
</a>
</div>
The code is analogical of figure/figcaption HTML5 structure.
Here's the case:
https://codepen.io/anon/pen/dYaYqV
On hover overlay background should hide (which is the case), and opacity of image increase to full.
Problem 1:
Text is not centered with such position setting (absolute).
Problem 2:
The overlay in this example is bigger (in the bottom of the image) due to some styling of , I think, element. Overlay should be exact as the image.
Problem 3:
Text should hide as well as overlay during img mouse hover
No JS if possible, only CSS. Can you help? Thanks, J.
I have edited your codepen example a bit, and i think this is exactly what you want
HTML:
<div id="1" class="figure">
<a href="#" class="link1">
<img src="http://www.w3schools.com/css/klematis.jpg" alt="flower Klematis">
<div class="figcaption"><h4>Klematis</h4></div>
</a>
</div>
CSS:
.figure {
position: relative;
float: left;
width: 10%;
margin-right: 1%;
left:20px;
}
.figure a{
display:block;
width:100%;
height:100%;
position:relative;
z-index:2;
}
.figure a img{
width:100%;
display:block;
}
.figcaption {
font-size: 0.8em;
letter-spacing: 0.1em;
text-align: center;
position: absolute;
top: 0;
left:0;
width:100%;
z-index: 2;
height:100%;
background-color:rgba(0,0,0,.4);
transition:background-color 0.4s ease;
}
.figcaption h4{
position:absolute;
top:50%;
left:50%;
padding:0;
margin:0;
-moz-transform:translate(-50%, -50%);
-webkit-transform:translate(-50%, -50%);
transform:translate(-50%, -50%);
}
.figure a:hover .figcaption {
background-color:transparent;
}
sorry, forget to hide text on hover, here is the edited codepen http://codepen.io/gopal280377/pen/QjYyLL
tested on google chrome, hope it works for you
assign width to .figcaption to enable text-align,
moved anchor tag to parent of code block (my preference)
overlay overflow is probably due to undeclared image dimensions,
<a href="#" class="link1">
<div id="1" class="figure">
<img src="http://www.w3schools.com/css/klematis.jpg" alt="flower Klematis">
<div class="figcaption">Klematis</div>
</div>
</a>
.figure {
position: relative;
width: 10%;
height: auto;
background:rgba(92,104,117,0.8);
overflow: hidden;
}
.figcaption {
position: absolute;
font-size: 0.8em;
width: 100%;
letter-spacing: 0.1em;
text-align: center;
top: 50px;
z-index: 1 !important;
}
.figure img {
width: 100%;
opacity: 0.5
}
.link1:hover img {
opacity: 1;
-webkit-transition: .3s ease-in-out;
transition: .3s ease-in-out;
}
.link1:hover .figcaption {
display: none;
background:rgba(92,104,117,0.0);
}
My problem is that i want to display block from left to right. You can see my current effect and red box what I'm expecting to get.
what I'm doing wrong? as i did tried to use float left on nmenu_drop class.
CSS:
.wraper{
margin-left:10px;
float:left;
position:relative;
}
.notification_dropdown{
height:40px;
margin-right:10px;
float: right;
position:relative;
padding-left: 10px;
width:30px;
}
.nmenu_drop{
width:200px;
height:300px;
background:#FFF;
clear:both;
position:absolute;
margin-top:40px;
float:right;
}
.nmenu_drop{
display: none;
}
.notification_dropdown:hover + .nmenu_drop {
display: block;
background:#4B4B4B;
}
.nmenu_drop:hover {
display: block;
}
.notification_dropdown:hover{
background:#4B4B4B;
}
HTML:
<div class="wraper">
<div class="notification_dropdown">
<i class="fa fa-globe" style="font-size: 21;color: #8a8a8a; margin-top: 9px;"></i>
</div>
<div class="nmenu_drop">
notification
</div>
</div>
Try adding:
.nmenu_drop {
right: 0;
}
You can play with left and transition:
#wrapper{
position: relative; /* Important, we are going to offset to this div*/
}
#menu{
position: absolute;
width: 100%; /* It looks mobile, so I took this */
top: 0;
left: -105%; /* The extra 5% is easy fix to paddings and borders and stuff */
transition: left 0.5s; /* animate it */
}
#menu.Opened{
left: 0; /* position moved back in */
}
All you have to do now is to add a class Opened to it.
I've made a small demo
Much like this question here (How would I reverse a css transition property width?) I want to reverse the way my transition goes.
Unfortunately it's not working for me! It might be that my code is a little more complex then that. Can anyone lend me a hand?
JSFiddle = http://jsfiddle.net/cPUuL/4/
CSS:
.Imgpad
{
padding-top:2px;
padding-left:2px;
padding-bottom:3px;
padding-right:2px;
position:absolute;
z-index:1;
}
.hidetext {
float:right;
display:none;
margin:0;
padding:0;
color:#CC0000;
font-size:30px;
font-family:"Juice ITC";
}
.Rightbox
{
width:100px;
height:100px;
background:black;
transition: left 2s, width 2s;
position:absolute;
}
.Rightbox:hover{
width:250px;
}
.Rightbox:hover > .hidetext {
display:block;
}
HTML:
</div>
<div class="content-wrapper">
<div id="Divpos5">
<div class="Rightbox">
<img class="Imgpad" src="http://b.vimeocdn.com/ps/588/58832_300.jpg" height="96" width="96" alt="Faye">
<p class="hidetext">Raven Faye<br><font color="#9900CC"></font>~The Sorceress
</div>
</div>
Thanks
-Asteria
Not sure if that's what you were looking for but here's what I did...
http://jsfiddle.net/cPUuL/5/
The css:
.Imgpad {
padding-top:2px;
padding-left:2px;
padding-bottom:3px;
padding-right:2px;
}
.hidetext {
position: absolute;
left: 0px;
top: 0px;
padding: 2px;
margin: 0px;
color:#CC0000;
font-size:30px;
font-family:"Juice ITC";
background: #000;
height: 96px;
width: 96px;
overflow: hidden;
z-index: -1;
transition: left 0.5s, width 0.5s;
}
.Rightbox {
width: 100px;
height: 100px;
background:black;
position: relative;
}
.Rightbox:hover > .hidetext {
left: 100px;
width: 250px;
transition: left 1s, width 1s;
}
As you can see the transition speed on the .Rightbox:hover > .hidetext; is slower than the one without :hover, It means that the reverse transition will change faster than on .Rightbox:hover > .hidetext. In other words, the reverse transition is when you move your mouse out of the Rightbox.
And the html fixed. You have lots of unclosed tags and the font tag that is clearly useless there.
<div class="Rightbox">
<img class="Imgpad" src="http://b.vimeocdn.com/ps/588/58832_300.jpg" height="96" width="96" alt="Faye" />
<p class="hidetext">Raven Faye<br />~The Sorceress</p>
</div>
Here's an updated fiddle that change the right property since if you want to make it move to the left, you'll have to change the right corner.
http://jsfiddle.net/cPUuL/6/
The css changed is:
.Rightbox:hover > .hidetext {
right: 100px;
width: 250px;
transition: left 1s, width 1s;
}
.hidetext {
...
right: 0px; /* instead of left: 0px; */
...
}
I also added a margin to Rightbox so we can see the change.
Using this css you can also make a cool transition:
.Rightbox,
.Imgpad,
.hidetext {
transition: left 1s, width 1s;
}
.Rightbox:hover,
.Rightbox:hover .Imgpad,
.Rightbox:hover .hidetext {
transition: left 0.5s, width 0.5s;
}
.Imgpad {
z-index: 2;
position: absolute;
top: 0px;
right: 0px;
padding-top:2px;
padding-left:2px;
padding-bottom:3px;
padding-right:2px;
}
.hidetext {
position: absolute;
top: 2px;
left: 2px;
right: 102px;
bottom: 2px;
margin: 0px;
color: #CC0000;
font-size:30px;
font-family:"Juice ITC";
overflow: hidden;
z-index: 1;
white-space: nowrap;
}
.Rightbox {
width: 100px;
height: 100px;
background:black;
position: relative;
}
.Rightbox:hover {
width: 404px;
}