My footer doesnt show up at the bottom, it does on all the other pages except this one(code below). the content in the footer shows up at the bottom(wrong positions of the component, but still at the bottom) but the backgroud color is in the middle of the page.
Here is the code:
<footer id="fots">
<div id="infof">
<div id="infoc">
<ul class="ulfot" id="ulfk">
<li><b>Destinatons</b></li>
<li>London</li>
<li>Sarajevo</li>
<li>Istanbul</li>
<li>Gothenburg</li>
</ul>
<ul class="ulfot">
<li><b>Flight info</b></li>
<li>Before flying</li>
<li>When flying</li>
<li>After flying</li>
</ul>
</div>
</div>
<div id="fotsd">
<div id="leftis">
<p><b> © something </b></p>
</div>
<div id="rightis">
Back to top <span class="glyphicon glyphicon-arrow-up"></span>
</div>
</div>
</footer>
here is the css:
#infoc{
width: 960px;
display: block;
margin-left: auto;
margin-right: auto;
}
#fots{
background-color: #ebebeb;
width: 100%;
}
#fotsd{
height: 50px;
padding-top:15px;
padding-left: 5px;
padding-right: 5px;
width: 960px;
display: block;
margin-left: auto;
margin-right: auto;
}
#leftis{
width: 300px;
float: left;
font-family: 'Raleway', sans-serif;
}
#rightis{
width: 300px;
float: right;
text-align: right;
color: black;
font-family: 'Raleway', sans-serif;
}
#bks{
color: black;
}
#infof{
width: 100%;
height: 180px;
background-color: gray;
}
If I understand correctly this is what you want: FIDDLE
change this CSS
#fots{
background-color: #ebebeb;
width: 100%;
}
to this:
#fots{
background-color: #ebebeb;
width: 100%;
position:fixed; /*new*/
bottom:0;/*new */
}
and change this CSS:
#infof{
width: 100%;
height: 180px;
background-color: gray;
}
to this:
#infof{
width: 100%;
/*height: 180px;*/ /*removed*/
background-color: gray;
}
#fots {
position: absolute;
bottom: 0;
width: 100%;
height: 60px;
background: #ebebeb;
}
Setting the position to absolute should keep it on the bottom, according to this source (first google result..)
Related
My footer doesn't stay at the bottom. I did div "all content" with height = 100%.
Body and html = 100%, footer position absolute. And bottom -50px;
But footer jumps and stays in the centre of screen.
Especially it happens with a mobile screen.
Also footer makes blue boxes stick to each other in mobile version.
What is wrong?
.all-content{
min-height: 100%;
/* margin-bottom: -50px; */
}
/*
******************
* ABOUT US
******************
*/
.about-us{
width: 100%;
min-height: 100%;
min-height: 500px;
position: relative;
}
.girl{
width: 100%;
height: 100%;
position: absolute;
z-index: 1;
}
.doctor{
margin-left: 20vw;
height: 95%;
position: absolute;
z-index: 2;
bottom: 0px;
}
.info-text{
position: absolute;
z-index: 2;
right: 20vw;
top: 60px;
text-align: right;
}
.info-text h1, .info-text h2, .info-text h5,.icon-facebook {
color:white;
}
.info-text h1{
font-size: 3em;
color: #0082c6;
}
.info-text h2{
font-size: 2em;
}
.info-text h4, .info-text h2, .info-text h1{
line-height: 1;
}
.info-text hr{
margin-top: 1vh;
margin-bottom: 2vh;
margin-left: 10px;
margin-right: 10px;
border:none;
height: 1px;
background-color: #D8D8D8;
}
.fist-button{
padding: 10px 40px;
float: right;
}
.icon-facebook{
border: 2px solid white;
border-radius: 50%;
padding: 3px;
font-size: 2em;
}
.hidden{
display: none;
}
#media (max-width: 1360px){
.doctor{
margin-left: 15vw;
}
.info-text{
right: 15vw;
}
}
#media (max-width: 978px){
.info-text h5{
display: none;
}.doctor{
margin-left: 20px;
}
.fist-button{
display: none;
}
.info-text{
right: 20px;
}
.info-text hr{
position: absolute;
top: 0;
right: 0;
z-index: 2;
border:none;
height: 1px;
background-color: #D8D8D8;
width: 250px;
}
.info-text h1{
font-size: 2em;
color: #0082c6;
font-family: 'OpenSansHebrew-Bold';
margin-top: 20px;
}
.info-text h2{
padding-top: 0px;
font-size: 1.5em;
font-family: 'OpenSansHebrew-Bold';
}
.hidden{
display: block;
}
}
/*
******************
* OUR TREATMENTS
******************
*/
/* .our-treatments{
width: 100%;
height: 350px;
background: white;
text-align: center;
} */
.tree-columns-container{
margin-left: 18%;
margin-right: 18%;
min-height: 100%;
/* min-height: 350px; */
}
.column-container{
display:block;
margin-right: 4%;
height: 100%;
width: 257px;
position: relative;
}
.img-container{
height: 120px;
width: 100%;
text-align: center;
}
.column-container img{
margin:auto;
margin-top: 30px;
}
.blue-small{
display: table;
background: #0082c6;
height: 70px;
width:90%;
margin: 0 5%;
top:120px;
position: absolute;
z-index: 2;
text-align: center;
}
.blue-small h3{
display: table-cell;
vertical-align: middle;
}
.blue-big{
height:auto;
min-height: 330px;
width:100%;
background:#61c2ee;
position: absolute;
z-index: 1;
top:160px;
text-align: center;
}
.blue-big h4{
text-align: right;
padding-right: 20px;
padding-top: 10px;
font-size: 0.9em;
}
.column-container h3{
color: white;
}
.column-container h4{
margin-top: 50px;
color: white;
}
.blue-big button{
padding: 10px 30px;
background: #61c2ee;
border: 1px solid white;
font-size: 1em;
}
.blue-big table{
margin-top: 50px;
color: white;
border-spacing:15px;
border-collapse: separate;
}
.blue-big table tr td{
text-align: right;
padding-right: 10px;
}
.blue-big table tr td:first-child{
border-right: 1px solid #fff;
}
.blue-big table tr{
margin-top: 10px;
}
.td-number{
font-size: 1.6em;
vertical-align:middle;
}
#media (min-width: 1160px){
.tree-columns-container{
height: 350px;
}
.column-container{
float: left;
}
.column-container:last-child{
margin-right: 0px;
}
}
#media (max-width: 1160px){
.tree-columns-container{
height: 100%;
}
.column-container{
margin: 10px auto 0px;
width: 257px;
}
}
.footer{
width: 100%;
height: 50px;
background: grey;
position: absolute;
margin-top: -50px;
}
.footer h5{
margin-top:15px;
}
.footer h5:first-child{
float: left;
}
.footer h5:last-child{
float: right;
}
#media (min-width: 978px){
.footer-content{
margin-left: 18%;
margin-right: 18%;
height: 30px;
}
}
#media (max-width: 978px){
.footer{
height: 140px;
}
.footer-content{
margin-left: 10%;
margin-right: 10%;
}
}
<body>
<div class="all-content">
<img class="doctor" src="img/Doctor.png" alt="Doctor">
<img class="girl" src="img/girl.png" alt="Girl">
<div class="clear"></div>
</div>
<div class="tree-columns-container">
<div class="column-container">
<div class="img-container">
<img src="img/hand.png">
</div>
<div class="blue-small">
<h3>
מהם המפתחות
<br> ?להצלחת הניתוח
</h3>
</div>
<div class="blue-big">
<table>
<tr>
<td>
<h5>לבוא מוכן לניתוח - להכיר את סוגי הניתוחים ולהבין את המהלך הצפוי
</h5>
</td>
<td class="td-number">1</td>
</tr>
<tr>
<td>
<h5>לבחור את המנתח הנכון במקום הנכון - מנתח המתמחה בניתוחי קיצור קיבה, בעל ניסיון עשיר וסביבת
עבודה עם כל המערך התומך הנדרש
</h5>
</td>
<td class="td-number">2</td>
</tr>
<tr>
<td>
<h5>להקפיד על ההנחיות לאחר הניתוח - תזונה, פעילות גופנית ונטילת ויטמינים ותוספי מזון
</h5>
</td>
<td class="td-number">3</td>
</tr>
</table>
</div>
<div class="clear"></div>
</div>
<div class="column-container">
<div class="img-container">
<img src="img/notes.png">
</div>
<div class="blue-small">
<h3>
?שלי BMB-מה ה
</h3>
</div>
<div class="blue-big">
<h4>
.מדד מסת הגוף הינו חישוב פשוט של
<br>משקל הגוף חלקי ריבוע הגובה
</h4>
<button>
חשב/י את ה-BMI שלך
</button>
</div>
</div>
<div class="column-container">
<div class="img-container">
<img src="img/weigher.png">
</div>
<div class="blue-small">
<h3>
מהם הקריטריונים
<br>?לניתוח קיצור קיבה
</h3>
</div>
<div class="blue-big">
<table>
<tr>
<td>
<h5>BMI > 40
</h5>
</td>
<td class="td-number">1</td>
</tr>
<tr>
<td>
<h5>BMI > 35 עם תחלואה נלווית הקשורה להשמנת יתר כגון סכרת, יתר לחץ דם, עודף כולסטרול, דום נשימה
בשינה, בעיות אורטופדיות, הפרעה בפוריות, כבד שומני ועוד
</h5>
</td>
<td class="td-number">2</td>
</tr>
<tr>
<td>
<h5>BMI > 30 לאחר כישלון ניתוח קיצור קיבה קודם או עם סכרת קשה ולא מאוזנת (במסגרת מחקרית)</h5>
</td>
<td class="td-number">3</td>
</tr>
</table>
<div class="clear"></div>
</div>
</div>
</div>
</div>
<script src="main.js"></script>
</body>
<footer class="footer">
<div class="footer-content">
<h5>לקביעת תור לד"ר אלדר חייגו 052-4262021 </h5>
<h5>ד"ר שי מרון אלדר פתרונות כירורגיים להשמנת יתר </h5>
</div>
<div class="clear"></div>
</footer>
</html>
Try wrapping all your content except the footer into a container (in the example named all-other-content) and apply the following css to your code.
The added bonus is that you can have a responsive variable height footer and is compatible with all browsers. Also, when page content height exceeds viewport's height, the footer is just pushed downwards.
As an additional remark, try removing absolute positioning from your layout, which is certainly going to cause sou layout issues.
Example html:
<div class="all-content">
<div class="all-other-content">
All other content
</div>
<div class="footer">
Footer
</div>
</div>
Example css:
html,
body {
width: 100%;
height: 100%;
margin: 0;
padding: 0;
}
.all-content {
display: table;
table-layout: fixed;
width: 100%;
height: 100%;
}
.all-other-content {
display: table-row;
height: 100%;
}
.footer {
display: table-row;
height: 1px;
background: gray;
}
Here is a working fiddle:
https://jsfiddle.net/3zctbsb3/
You also use too much the absolute positioning. Absolute positioning means that the element is removed from the normal document flow and no space is created for it, and a it creates a new stacking context (read more here:Positioning). What this means is that your elements will not stay one after the other because they might be on different levels and overlay. This is the main reason why they don't render correctly. Try relative positioning or if you can just let it be static.
I am making website in html and css and I have a problem. In my css file I made id "full" which set wooden background after sidebar and it should continue on all page. In my class "picture" I made 80% width white panel - so there should be 80% white background in the middle and 10% edges should be wooden. It works correctly untill my article section, where I added some images of pizzeria. Immediately there is no wooden edges, only white. I don´t understand because my "full" id and "picture" class continue untill end of the body. Could somebody see where is error please?
Image showing error
* {
padding: 0;
margin: 0;
border: 0;
}
.container {
margin: auto;
overflow: hidden;
width: 100%;
}
#full {
background-image: url("http://newallpaper.com/wp-content/uploads/2014/01/Dark-Wood-620x387.jpg");
}
.picture {
margin: auto;
width: 80%;
background: white;
}
#pizzaObrazok {
background-image: url("img/pizzaCompleted.png");
width: 100%;
height: 210px;
margin: 0px;
}
nav {
float: left;
margin-left: 2px;
width: 100%;
height: 32px;
}
ul {
float: left
}
li {
display: inline;
border: 4px solid black;
font-size: 24px;
padding: 10px 64px;
background-color: #990000;
color: #ffffff;
}
li a {
color: #ffffff;
text-decoration: none;
padding-top: 8px;
padding-bottom: 5px;
vertical-align: middle;
}
#imgPizza {
width: 59%;
height: 270px;
padding-left: 190px;
padding-top: 30px;
padding-bottom: 30px;
}
article p {
font-size: 120%;
font-family: fantasy;
text-align: center;
margin-right: 160px;
}
#imgPizza2 {
width: 30%;
height: 270px;
position: absolute;
transform: rotate(345deg);
margin-top: 100px;
margin-left: 50px;
border: 6px solid red;
}
#imgPizza3 {
width: 30%;
height: 270px;
position: absolute;
margin-left: 390px;
margin-top: 100px;
transform: rotate(15deg);
border: 6px solid red;
}
#phone {
border: 2px solid black;
margin-top: 150px;
margin-right: 180px;
padding: 5px;
position: absolute;
display: inline;
text-align: center;
background: #ff4d4d;
}
<header>
<div id="pizzaObrazok">
</div>
</header>
<div id="full">
<section id="navigation">
<div class="container">
<nav>
<ul>
<li>ÚVOD</li>
<li>FOTO</li>
<li>JEDÁLNY LÍSTOK</li>
<li>KDE NÁS NÁJDETE</li>
<li>NÁZORY</li>
</ul>
</nav>
</div>
 
</section>
<div class="picture">
<img id="imgPizza" src="img/pizzacheese.jpg">
<aside id="phone">
<h2>Telefónne číslo:</h2>
<h2> 0905 741 963</h2>
</aside>
</div>
 
<div class="picture">
<article>
<p>U nás dostanete najchutnejšiu pizzu z výlučne kvalitných surovín</p>
<img id="imgPizza2" src="https://cdn.vox-cdn.com/uploads/chorus_image/image/50289897/pizzeria_otto.0.0.jpg">
<img id="imgPizza3" src="https://media-cdn.tripadvisor.com/media/photo-s/09/bc/74/79/pizzeria-du-drugstore.jpg">
</article>
</div>
</div>
You have your elements "#imgPizza2" and "#imgPizza3" whit position absolute outside your "#full" wrapper. You can do various things to achive the effect you are looking for but depends of many others things.
I think the simpliest way is to put your background image in to the body and not in the warpper "#full" or change the postion of your images among others.
body {
background-image: url("http://newallpaper.com/wp-content/uploads/2014/01/Dark-Wood-620x387.jpg");
}
It looks like the wood background is 620 x 387, so my first thought is that it is big enough to cover the first section but not the articles. Maybe add background-repeat: repeat-y; to your #full class and see if the wood border spreads further down the page.
My banner is meant to be directly under the navigation bar but as of now, there is a space between it. I tried to use top for css and it doesn't move.
The css for the banner is:
/*Index CSS*/
* {
margin:0px; padding: 0px;
}
body {
position: absolute;
width: 1250px;
height: auto;
margin-left: auto;
margin-right: auto;
}
#wrapper {
background-color: rgb(161, 193, 217);
position: absolute;
width: 1250px;
height: auto;
margin-left: 5px;
margin-right: 5px;
}
#welcome {
background: url(../Resources/Header/CUiZMwBXAAAQy1M.jpg);
width: 1250px;
height: 480px;
}
#WelcomeTo {
color: white;
font-size: 55px;
text-align: center;
font-family: Bebas;
margin-top: 100px;
}
#LittleChef {
color: white;
font-size: 60px;
text-align: center;
font-family: Candy Shop Personal Use;
}
<div id="welcome" name="banner">
<div id="WelcomeTo" name="WelcomeTo">
<h1>WELCOME<br>TO</h1>
</div>
<div id="LittleChef" name="LittleChef">
<h1>Little Chef</h1>
</div>
</div>
I've had this problem for a very long time. Here is a screenshot to what it looks like as of now.
it is because the margin of your h1 element.
the solution is set the margin-top of h1 to 0.
Or you can set the padding of the wrapper
I have three divs. I want them to be in one line so I used inline-block. When I resize the window the third element (nav) stacks and then the 2nd element (searchBar). I want the 2nd element stacks first and then the 3rd one. For undoing, the 3rd element and then the 2nd element.
body {
margin: 0px;
padding: 0px;
}
header {
width: 100%;
min-eight: 48px;
position: fixed;
background: #ffffff;
padding-bottom: 5px;
border-bottom: 2px solid #fed700;
}
nav {
width: 489.7px;
height: 18px;
background: red;
display: inline-block;
}
#searchBar {
width: 330px;
height: 16px;
background: blue;
display: inline-block;
white-space: nowrap;
}
#logo {
width: 220px;
height: 32px;
background: green;
display: inline-block;
}
<header>
<div id=logo>logo
</div>
<div id=searchBar>searchBar
</div>
<nav>nav
</nav>
</header>
You could use an inline-block wrapper with a min-width, wrapping the nav and searchBar. That would give the result you wanted in with the code sample supplied, but might cause problems in the real world, depending on your requirements.
body {
margin: 0px;
padding: 0px;
}
header {
width: 100%;
min-height: 48px;
position: fixed;
background: #ffffff;
padding-bottom: 5px;
border-bottom: 2px solid #fed700;
}
.wrapper {
min-width: 50%;
display: inline-block;
}
nav {
width: 489.7px;
height: 18px;
background: red;
display: inline-block;
}
#searchBar {
width: 330px;
height: 16px;
background: blue;
display: inline-block;
white-space: nowrap;
}
#logo {
width: 220px;
height: 32px;
background: green;
display: inline-block;
}
<header>
<div id=logo>logo
</div>
<div class="wrapper">
<div id=searchBar>searchBar
</div>
<nav>nav
</nav>
</div>
</header>
I have a project where I need to align certain elements just so. For whatever reason, it's not working. My HTML:
<div class="heading">
<h1>Exotic <strong>Travel</strong></h1>
<div class="left">
<ul>
<li>homepage</li>
<br>
<li>about us</li>
<br>
<li>destinations</li>
<br>
<li>book a ticket</li>
<br>
<li>contact us</li>
</ul>
</div>
<div class="rightimg">
<img src="banner.jpg" alt="Beachside Hotel" />
</div>
<div class="righttext">
<h2>The Perfect Destination</h2>
</div>
</div>
and the CSS:
body {
background-image: url(sky.jpg);
font-family: "Verdana", sans serif;
}
h1 {
font-family: "Calibri Light", sans serif;
color: gray;
}
h2 {
background-color: green;
display: inline-block;
border: 0;
margin: 0;
text-align: center;
width: 750px;
}
a {
color: white;
margin: 4px;
padding: 5px 0 5px 0;
text-decoration: none;
}
.left{
background-color: red;
display: inline-block;
float: left;
height: 200px;
width: 350px;
}
.heading {
background-color: white;
margin: 0 auto;
overflow: auto;
width: 1000px;
}
.righttext {
display: inline-block;
float: right;
height: 60px;
width: 750px;
}
.rightimg {
display: inline-block;
float: right;
margin: 0;
padding: 0;
width: 750px;
}
This SHOULD be working, based on other similar examples I've seen on the site, but it's not taking. Any help here would be appreciated.
I think you are breaking it with your fixed widths, I used 40% width on the left and righttext and that seemed to get everything inline:
.left{
background-color: red;
display: inline-block;
float: left;
height: 200px;
width: 40%;
}
.righttext {
display: inline-block;
float: right;
height: 60px;
width: 40%;
}
https://jsfiddle.net/bkyLojx4/
Also as an fyi br tags are not valid in a ul. Rather use css to handle the styling of the list.
It is because you have the elements at a fixed width which means the combined width of all 3 elements is more than the space available. Try using a percentile widths for adaptive design or adjusting it to the resolution you want to support.