My footer when full screen adds space to the right and when i use for example mobile view a chunk of my footer disappears. I just want it to stay at the bottom and not cover any content. Even when it shrinks to mobile view.
[![De red line is the extra space im talking about][1]][1]
#footer {
position: absolute;
left: 0;
bottom: 0 !important;
width: 100%;
height: 2.5rem;
padding-right: 0;
background-color: black;
border-top: 4px solid #F2D380;
overflow: auto;
}
#footer a {
color: white;
text-decoration: none;
}
<div id="footer">
<div class="row text-center justify-content-center">
<div class="col-lg-2 ">
Company Information
</div>
<div class="col-lg-2">
Privacy Policy and User Agreement
</div>
<div class="col-lg-2">
About
</div>
<div class="col-lg-2">
©2019 Copyright claim
</div>
<div class="col-lg-2">
<a href="#">
<img src="images/linkedin.png" class=" socialIcon">
</a>
<a href="#">
<img src="images/instagram.png" class=" socialIcon">
</a>
<a href="#">
<img src="images/facebook.png" class=" socialIcon">
</a>
<a href="#">
<img src="images/youtube.png" class="socialIcon">
</a>
</div>
</div>
</div>
So the issue of why the space is added and it covers content is because of the absolute positioning. If you do not want it to cover content you have a couple options. Set the content wrapper to a set height and the footer to the rest of that height so the footer stays visible at the bottom and wont cover content.
If you just want it to act as a footer and be at the bottom on mobile I would just set it to be position relative.
It is hard to envision what you are going for without other content on the page.
By specifying height: 2.5rem, you have given the footer a fixed height and it won't scale according to the content you have provided in it. Try height: auto, or height: max-content, because it seems your content is larger than the footer itself.
Also put margin: 0 to ensure no space is added around it
Related
I am working on a project and i can't seem to find a way that works to center and make my footer responsive.
This is my html code.
#footer {
position: absolute;
left:0;
bottom: 0;
width: 100%;
height: 2.5rem;
background-color: black;
border-top: 4px solid #F2D380 !important;
}
.socialIcon {//update
width: 20px;
}
<div id="footer">
<div class="col-lg-2 link_list">
Company Information
</div>
<div class="col-lg-2 link_list">
<a href="#" > Privacy Policy and User Agreement </a>
</div>
<div class="col-lg-2 link_list">
About
</div>
<div class="col-lg-2 link_list">
<a href="#" >
©2019 Copyright claim
</a>
</div>
```
<div class="col-sm-6 col-lg-3">//update
<a href="#">
<img src="images/linkedin.png" class=" socialIcon">
</a>
<a href="#" >
<img src="images/instagram.png" class=" socialIcon">
</a>
<a href="#">
<img src="images/facebook.png" class=" socialIcon">
</a>
<a href="#" >
<img src="images/youtube.png" class="socialIcon">
</a>
</div>
</div>
```
I tried some bootstrap classes like justify-content-center but it simply does not work. I know i need to be looking at flexbox but it won't work and i don't know what the problem is.
Thank you in advance for answering.
*Update after i did what i saw in the comments it doesn't work with the socialmedia icons.
I've edited your codes. I explained what I changed in the comment lines. I removed the display table. You don't need this with this codes.
Html :
<div id="footer">
<div class="row text-center"> // I added row here, and I've got all the columns in a row, because all columns must be in a row. I added a "text center" class to keep all the text in the middle.
<div class="col-sm-6 pb-sm-2 col-lg-3"> // that's how I arranged your columns . So they will adjust their width for each width value
Company Information
</div>
<div class="col-sm-6 col-lg-3">
Privacy Policy and User Agreement
</div>
<div class="col-sm-6 pb-sm-2 col-lg-3"> // "pb-sm-2" class to add padding bottom when dimensions are sm
About
</div>
<div class="col-sm-6 col-lg-3">
<a href="#">
©2019 Copyright claim
</a>
</div>
</div>
</div>
Css:
#footer {
position: absolute;
left: 0;
bottom: 0;
width: 100%;
/* height: 2.5rem; */ you can use padding this way instead of specifying height. if you give a single height value, you will need to set height separately for all dimensions.
padding: 20px;
background-color: black;
border-top: 4px solid #F2D380 !important;
}
I hope I could help. Good Luck!
See the code below. You can forget about wrapping each anchor within a "div". It will be a lot easier to simply group them into the parent DIV and then target them. This should work and you can have more flexibility. Also, don't have to worry about flexbox or any external libraries.
<style>
body{
height:2000px; /* for demonstration purposes*/
}
/* position the footer div RELATIVE and give it a "top" property of 100% so it always sits at the bottom regardless of your window height*/
#footer {
position: relative;
top:100%;
width: 100%;
height: 2.5rem;
background-color: black;
border-top: 4px solid #F2D380 !important;
}
/* center all items INSIDE the link_list DIV*/
.link_list{
text-align:center;
}
/* target all the ANCHOR tags as inline elements*/
.link_list a {
margin:50% 20px;
color:white;
text-decoration:none;
text-align: center;
flex: 0 0 16.666667%;
}
</style>
<body>
<div id="footer">
<div class="col-lg-2 link_list">
Company Information
<a href="#" > Privacy Policy and User Agreement </a>
About
<a href="#" >©2019 Copyright claim</a>
</div>
</div>
</body>
Add display:flex; to #footer and it gets a bit of responsiveness.
quick fiddle => https://jsfiddle.net/0b9hoag1/
I have created a profile page which is using many images of different sizes. For making it responsive I used twitter bootstrap3. For image I used img-circle m-t-xs img-responsive but still images are not displaying in a fixed width and height like as shown below.
But it works when I add a fixed height and width for .img-responsive as shown below, but again I know that will harm when it comes to responsive design.
.img-responsive {
height: 100px;
width: 100px;
}
Also actual view was looking fine like as shown below
when I zoom in it is showing so many white spaces like as shown below
Actual view
Zoom In View
Can anyone please help me how to get all those images in a fixed height and width in responsive for all resolutions. Also how I to arrange those white spaces when I zoomin
My complete web page is available in the below plunker (ther I have not added fixed height or width for .img-responsive class, can test by adding that)
https://plnkr.co/edit/qIDGjikGDetKI4LFAtmK?p=preview
maybe something like this:
<div class="col-lg-4">
<div class="contact-box row">
<a href="profile.html">
<div class="col-xs-4 col-sm-3 col-md-2 col-lg-4 text-center row">
<div style="width: 100%; padding-top: 100%; overflow: hidden; position: relative; height: 0;">
<div style="border-radius: 50%; position: absolute; top: 0; bottom: 0; left: 0; right: 0; background-image: url('https://cdn2.thedogapi.com/images/SkatQTaEQ.gif'); background-position: center; background-repeat: no-repeat;">
</div>
</div>
<div class="m-t-xs font-bold">House Name</div>
</div>
<div class="col-xs-8">
<h3><strong>Tinkku Baby</strong></h3>
<p><i class="fa fa-map-marker"></i> City Name</p>
<address>
<strong>Twitter, Inc.</strong><br>
795 Folsom Ave, Suite 600<br>
San Francisco, CA 94107<br>
<abbr title="Phone">P:</abbr> (123) 456-7890
</address>
</div>
<div class="clearfix"></div>
</a>
</div>
</div>
I am having a problem with my footer. I am trying to force it to the bottom, but it always looks ugly.
Here is the code:
<div id="footer">
<div class="container">
<div class="row">
<h3 class="footertext">About Us:</h3>
<br>
<div class="col-md-4">
<center>
<img src="http://oi60.tinypic.com/w8lycl.jpg" class="img-circle" alt="the-brains">
<br>
<h4 class="footertext">Programmer</h4>
<p class="footertext">You can thank all the crazy programming here to this guy.<br>
</center>
</div>
<div class="col-md-4">
<center>
<img src="http://oi60.tinypic.com/2z7enpc.jpg" class="img-circle" alt="...">
<br>
<h4 class="footertext">Artist</h4>
<p class="footertext">All the images here are hand drawn by this man.<br>
</center>
</div>
<div class="col-md-4">
<center>
<img src="http://oi61.tinypic.com/307n6ux.jpg" class="img-circle" alt="...">
<br>
<h4 class="footertext">Designer</h4>
<p class="footertext">This pretty site and the copy it holds are all thanks to this guy.<br>
</center>
</div>
</div>
<div class="row">
</div>
</div>
I tried to use
<div class="footer navbar-fixed-bottom">
but in that case my text ,which is located over the footer, get overlapped by footer
Here is css I used:
#footer {
padding-top: 100px
position: absolute;
bottom: 0;
width: 100%;
/* Sets the fixed height of the footer here */
height: 280px;
background:
/* color overlay */
linear-gradient(
rgba(240, 212, 0, 0.45),
rgba(0, 0, 0, 0.45)
),
/* image to overlay */
url(222.png);
}
.footertext {
color: #ffffff;
}
Here is what I mean by ugly. I did try to set html and body height as 100% in css
Please show us what you mean by "looks ugly" so we can help you, because we can't really understand your issue.
I'd say the problem could be in what the parent of #footer div.
I think you only have to change position: absolute; to position: relative; or position: fixed; for the div to stay at the bottom (depending on what behaviour you exactly expect).
Side note, don't use the tag <center> because it's now deprecated, use CSS instead (text-align: center).
You are missing a semi-colon after padding-top: 100px . You can also try position:fixed instead of position:absolute. An element with position: fixed; is positioned relative to the viewport, which means it always stays in the same place even if the page is scrolled.
Its <div class="footer navbar fixed-bottom">
not <div class="footer navbar-fixed-bottom">
you mistypes a -
I'm wrestling with bootstrap CSS and am having trouble lining up the last couple of pixels.
I'm trying to create a responsive row of round images, followed by a round link/button to add a new image. The markup is like this
<div class="container">
<div class='row'>
<div class="col-xs-2">
<a href="/url/to/object">
<img class="img-circle img-responsive" src="https://pensivepool.files.wordpress.com/2012/01/josef-albers-study-for-homage-to-the-square-silkscreen-print-80774.jpg">
</a>
</div>
<div class="col-xs-2">
<a href="/url/to/object">
<img class="img-circle img-responsive" src="https://pensivepool.files.wordpress.com/2012/01/josef-albers-study-for-homage-to-the-square-silkscreen-print-80774.jpg">
</a>
</div>
<div class="col-xs-2">
<a class="btn btn-default btn-circle btn-responsive" href="#link_to_add_new">
<i class="fa fa-plus"></i>
</a>
</div>
</div>
</div>
I've put an example with css on jsfiddle. http://jsfiddle.net/9fgd4972/
As you can see, the button is 1 or 2 pixels too high, and this is due to the extra width of the border. What is the best way to account for this border in the css, so that the circle remains responsive.
Also, what is the best way to vertically align the + text within that height.
Thanks for suggestions.
You could try to change the border with a box-shadow.
About the vertical alignment you could position the icon (+) with position absolute, set all the values to 0 (top, right, bottom, left), margin and height to auto and max-height to the exactly height of the icon.
Like this:
box-shadow: 0 0 0 1px #ccc;
And:
position: absolute;
top: 0;
left: 0;
bottom: 0;
right: 0;
padding: 0;
margin: auto;
height: auto;
max-height: 12px;
Here's a working fiddle: http://jsfiddle.net/alessiozuccotti/14v1f8rk/4/
Here's my HTML:
<div class="navbar navbxar-inverse navbar-fixed-bottom" role="navigation" style="min-width: 320px; height: 51px;">
<div class="container-fluid" style="display: table;">
<div class="row row-mod">
<div class="col-xs-7 col-xs-7-mod" style="background-color: blue;">
<a class="navbar-logo pull-left" href="/"><img class="img-responsive" src="http://s24.postimg.org/intj0mv3l/logo.jpg" /></a>
<span class="navbar-footer-text-container">
<span class="navbar-footer-text">CUSTOMER SERVICES | STORE </br>COPYRIGHT © BRND 2006/2014</span>
</span>
</div>
<div class="col-xs-5 col-xs-5-mod" style="padding-right: auto; background-color: red;">
<img style="margin-left: 1px;" class="pull-right img-responsive" src="http://s4.postimg.org/kus2gqabd/image.jpg" />
<img style="margin-left: 1px;" class="pull-right img-responsive" src="http://s4.postimg.org/kus2gqabd/image.jpg" />
<img class="pull-right img-responsive" src="http://s4.postimg.org/kus2gqabd/image.jpg" />
</div>
</div>
</div>
</div>
My CSS is added to JSFiddle.
Currently the problems are:
1. The bigger yellow image is not centered vertically in the blue div, it is on the bottom of the div
2. The smaller yellow images are not centered vertically in the red div, they are on the top of the div
3. The smaller yellow images are not on the right of the red div. There is a little space, I couldn't find why this space appears
4. The yellow images are set to be responsive. I've set this, because I've also set a rule to resize the navbar under 410px to have only 39px height. This feature is necessary, because then on smaller screens the text doesn't have to go to the next row, so everything fits like on bigger screens. The problem is that it isn't working this currently.
Do you have any clues for these problems?
Edit:
I would like to achieve the following layout:
1. The bigger image (the logo) and the text should be on the left side
2. The text after the logo must be in 2 lines and the space between the two lines should be small
3. The other three images should be on the right
4. The navigation bar should have a width as the window
5. The content on the navigation bar should have a maximum widht of 976px
6. The navigation bar should have a height of 51px
7. The text should have an 8pt size
These settings should be changed a bit when the screen size is lower than 410px. This is necessary, because under 410px the content cannot fit in the space, so in case the navbar is only 39px and also the images will be resized according to this height than everything can fit.
the main issue is your mix of inline and external styles, quite a mess. Within that mess, you have that bottom nav with a display:table declaration. Basically, you're trying to re-invent the wheel. I don't know why are you doing this, but following your logic, I've fixed your code so it works. See fiddle and HTML code below.
<div class="navbar navbxar-inverse navbar-fixed-bottom navbar-bottom" role="navigation">
<div class="container-fluid" style="display: table; padding:0; margin:0 auto">
<div class="row row-mod">
<div class="col-xs-7 col-xs-7-mod" style="background-color: blue; ">
<a class="navbar-logo pull-left" href="/"><img class="img-responsive" style="margin-left: 1px; margin-top:-9px; display:inline; vertical-align:50%; height:47px;" src="http://s24.postimg.org/intj0mv3l/logo.jpg" /></a>
<span class="navbar-footer-text-container">
<span class="navbar-footer-text">CUSTOMER SERVICES | STORE </br>COPYRIGHT © BRND 2006/2014</span>
</span>
</div>
<div class="col-xs-5 col-xs-5-mod" style="padding-right: auto; background-color: red; ">
<img style="margin-left: 1px; margin-top:9px" class="pull-right img-responsive" src="http://s4.postimg.org/kus2gqabd/image.jpg" />
<img style="margin-left: 1px; margin-top:9px" class="pull-right img-responsive" src="http://s4.postimg.org/kus2gqabd/image.jpg" />
<img style="margin-left: 1px; margin-top:9px" class="pull-right img-responsive" src="http://s4.postimg.org/kus2gqabd/image.jpg" />
</div>
</div>
</div>
Now, my suggestion would be for you to use Bootstrap as it is, it really works fine without any reinvention.