I am trying to refine the fluid design of my website, such that it will work down to 480px width. I have a section almost done but am hung up on the footer fixed to the bottom.
It does what i want except i can't get the img to align beside the text in the middle. The img keeps getting pushed down. Link
html:
<footer>
<div class="bottom" style="width: 30%;"> </div>
<div class="bottom" style="width: 30%;">
<div style="text-align: right;">
kim#<br>briligg.com
</div>
<div>
<a rel="license" href="http://creativecommons.org/licenses/by/4.0/">
<img alt="Creative Commons License" style="border-width:0" src="https://i.creativecommons.org/l/by/4.0/88x31.png"
title="This work is licensed under a Creative Commons Attribution 4.0 International License. If you use this
work, attribute it to Kim Holder, and briligg.com."/>
</a>
</div>
</div>
<div class="bottom" style="width: 30%;"> </div>
</footer>
css:
footer {
width: 100%;
height: 45px;
position: fixed;
bottom: 0px;
background-color: #000015;
}
div.bottom {
float: left;
margin: 10px auto;
height: 40px;
color: #9dab71;
font-size: 0.8em;
display: inline;
}
div.bottom div {
display: inline;
}
div.bottom img {
float: right;
padding: 5px;
margin: 2px auto;
}
It feels like this should be easy and i'm just missing something. :P
reduce margins
margin: 5px auto;
instead of float img to right, parent div floated to right
and use display: inline-block; for text
https://jsfiddle.net/kokilajs/pt69y332/6/
<footer>
<div class="bottom" style="width: 33%;"> </div>
<div class="bottom" style="width: 33%;">
<div style="text-align: right;">
kim#<br/>briligg.com
</div>
<div id="test" >
<a rel="license" href="http://creativecommons.org/licenses/by/4.0/">
<img alt="Creative Commons License" style="border-width:0" src="https://i.creativecommons.org/l/by/4.0/88x31.png"
title="This work is licensed under a Creative Commons Attribution 4.0 International License. If you use this
work, attribute it to Kim Holder, and briligg.com."/>
</a>
</div>
</div>
<div class="bottom" style="width: 33%;"> </div>
</footer>
Style :
footer {
width: 100%;
height: 45px;
position: fixed;
bottom: 0px;
background-color: #000015;
}
div.bottom {
float: left;
margin: 5px auto;
height: 40px;
color: #9dab71;
font-size: 0.8em;
display: inline;
}
div.bottom div {
display: inline-block;
}
#test{
float: right;
margin: 0;
}
Related
I have been designing a website using html and css, for which i have made a footer.
the code for the footer is as follows:
footer {
color: white;
width: 100%;
height: 40px;
padding: 0;
display: block;
clear: both;
}
.footrow {
overflow: hidden;
background-color: #111;
display: block;
line-height: 18px;
background-image: url('../images/footer.jpg');
}
.footrow2 {
overflow: hidden;
background-color: #002c42;
display: block;
padding: 15px;
height: 48px;
}
.foot {
max-width: 1080px;
margin: 0 auto;
font-size: 11px;
}
.foot-p {
font-weight: 600;
color: #66e355 !important;
margin: 15px;
}
.half-width {
width: 50%;
float: left;
line-height: 1px;
}
.quarter-width {
width: calc(25% - 30px);
float: left;
padding: 20px;
}
#social2 {
display: block;
background-color: transparent;
float: left;
margin: 0 auto;
}
.sc-icn2 {
width: 50px;
height: 50px;
display: block;
margin-right: 5px;
margin-bottom: 5px;
float: left;
}
<footer>
<div class="footrow">
<div class="foot">
<div class="quarter-width">
<p style="color:#fff;">Address</p>
<hr>
<div>
Science & Technology University
<hr> Phone: 02-7458745
<hr> Email: registrar#abc.gmail.com
</div>
</div>
<div class="quarter-width">
<p style="color:#fff;">Quick Links</p>
<hr>
Link 1<br>
Link 2<br>
Link 3<br>
</div>
<div class="quarter-width">
<p style="color:#fff;">Follow Us</p>
<hr>
<div id="social2">
<div class="sc-icn2">
<img src="images/social/facebook.png" width="50px" height="50px" alt="facebook" title="fb">
</div>
<div class="sc-icn2">
<img src="images/social/twitter.png" width="50px" height="50px" alt="twitter" title="#board">
</div>
<div class="sc-icn2">
<img src="images/social/instagram2.png" width="50px" height="50px" alt="instagram" title=" Photography">
</div>
</div>
</div>
<div class="quarter-width">
<p style="color:#fff;">Report</p>
<hr>
<a style="cursor:pointer;" onclick="feedClick('bug')">Found
a Bug</a><br>
<a style="cursor:pointer;" onclick="feedClick('feed')">Feedback</a><br>
<a style="cursor:pointer;" onclick="feedClick('feature')">Request feature</a><br>
</div>
</div>
</div>
<div class="footrow2">
<div class="foot">
<div class="half-width">
<p class="foot-p">©- 2018 | All rights reserved</p>
</div>
<div class="half-width">
<p style="float:right !important;" class="foot-p">Developed & Maintained By <a style="color:orange" href="https://www.facebook.com/abc"><strong>SK Biswas</strong></a></p>
</div>
</div>
</div>
</footer>
The footer has two parts. one is within class "footrow" and another is within "footrow2". footrow will take position above footrow2. the problem is the height of the content of footrow2 class is taking different height for different pages. Is there any way to make it of a fixed height?
If you want to give any element 100% width of your page better use the vw instead of % as:
width: 10vw;
vw stands for viewport width and 10 means 100%. It will set the complete width on all devices.
I have kind of titles on my website which looks like this:
The problem appears when I rezise the window:
My text is being moved up and I want it to stretch down. Here is my HTML code:
<div class="inner, header2">
<div class="first">
<img src="images/clean/kim_icon.png" alt="" />
</div>
<div class="second">
<p class="section">S.I.M.B.A. (Smart Infant Management and Breath Aid)</p>
</div>
</div>
And my CSS:
.header2 {
text-align: left;
padding: 3em 6em 0em 6em;
overflow: hidden;
position: relative;
}
.first { //image
float: left;
}
.second { //text
float: left;
position: absolute;
bottom: 0em;
left: 12em;
}
p{
font-size: 2.75em;
margin-bottom: 1em;
line-height: 100%;
margin: 0 0 2em 0;
}
An option is to use a flexbox. The text will be placed at the bottom where possible.
.header2 {
display: flex;
}
.second {
align-self: flex-end;
}
p {
font-size: 2.75em;
margin: 0;
}
<div class="inner header2">
<div class="first">
<img src="http://placehold.it/100" alt="" />
</div>
<div class="second">
<p class="section">S.I.M.B.A. (Smart Infant Management and Breath Aid)</p>
</div>
</div>
I can't get my social media buttons to align left or right on the footer of my website. I'm not sure what I'm doing wrong, can anyone please help?
I have tried margin-left, margin-right, float: left, float: right
This is what I have and all it does is center.
HTML
<footer class="container-fluid text-center">
<div class="row" id="contact">
<p class="col-sm-4"></p>
<h1>Reach me here</h1>
<br>
<br>
<a href="https://twitter.com/Aarons_coding" target="_blank">
<img src="images/twitter.png" alt="twitter" id="twitt">
<br/> Follower me
</a>
<a href='https://www.facebook.com/freelancecoding/posts/1534409766779543' target="_blank">
<img src="images/fb.png" alt="fb" id="fb">
<br/>Like Me on FB
</a>
<a href='https://www.linkedin.com/in/aaron-s-706193125' target="_blank">
<img src="images/link.png" alt="linkedin" id="link">
<br/>Connect with me
</a>
</div>
<ul>
<li>Top</li>
<li>About the Designer</li>
</ul>
<iframe src="https://www.google.com/maps/embed?pb=!1m18!1m12!1m3!1d401398.0917589909!2d-85.9569564028764!3d38.18847214627973!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x88690b1ab35bd511%3A0xd4d3b4282071fd32!2sLouisville%2C+KY!5e0!3m2!1sen!2sus!4v1470171263135"
width="350" height="250" frameborder="0" style="border:0" allowfullscreen></iframe>
<div style="clear: both"></div>
</footer>
CSS
#twitt {
width: 95px;
height: 95px;
margin: 5px 5px 0 18px;
}
#fb {
width: 95px;
height: 95px;
margin: 5px 0 5px;
}
#link {
width: 95px;
height: 95px;
margin: 5px 5px 0 5px;
}
footer {
background-color: rgba(0, 0, 0, 1);
font-size: 12px;
padding: 20px 0;
text-align: center;
}
footer .col-sm-4 {
display: flex;
justify-content: flex-end;
}
footer ul {
float: right;
text-align: right;
list-style: none;
}
footer li img {
width: 32px;
height: 32px;
}
You probably didn't set styles on correct elements.
If you do it like this it works:
#contact a{
float: left;
}
Example here https://jsfiddle.net/hw3odrba/
You need to set a new style in your css, in case you want to align items to the right:
#contact a{
float: right;
}
I am trying to create a setup mimicking the one in the link with an image, text and a border all horizontally and vertically centered. I've tried a number of different ideas.
The below is the closest I've gotten but even then I'm still experiencing issues with the border displaying and things not being centered the way I want them.
<div style="max-width: 800px; height border: 1px solid #c6c6c6; border-radius: 5px; padding: 35px; margin-left: 60px; float: center; height: 220px; display: inline-block;">
<img src="image.gif" />
</div>
<div style="height: 220px; display: inline-block;">
<div style="position: relative; top: 50%;">
<h4 style="text-align: center;">Text 1/h4>
<p style="text-align: center;">Text 2<br />Text 3</p>
</div>
</div>
I would try using CSS tables, put the image and the text in separate block level elements that use display: table-cell, all of which are contained in a parent container using display: table.
.wrapper {
border: 1px solid gray;
border-radius: 5px;
display: table;
height: 220px;
margin: 0 auto;
}
.wrapper .item {
display: table-cell;
vertical-align: middle;
text-align: center;
min-width: 200px;
padding: 35px;
}
.item img {
display: block;
}
<div class="wrapper">
<div class="item">
<a href="www.google.com" target="_blank">
<img src="http://placehold.it/200x150" />
</a>
</div>
<div class="item">
<h4>Text Line One</h4>
<p>Text 2
<br />Text 3</p>
</div>
</div>
you should put inline-block on image and the parent div of text panel and vertical-align:middle .. would do that
.textpane{
height: 220px;
display: inline-block;
vertical-align:middle;
}
.imagepane{
width:50px;
height:50px;
display:inline-block;
vertical-align:middle;
max-width: 800px;
border: 1px solid #c6c6c6;
border-radius: 5px;
padding: 35px;
margin-left: 60px;
height: 220px;
}
<div class='imagepane'>
<img src="image.gif" />
</div>
<div class='textpane'>
<div style="position: relative; top: 50%;">
<h4 style="text-align: center;">Text 1/h4>
<p style="text-align: center;">Text 2<br />Text 3</p>
</div>
</div>
jsfiddle
Note
there is not such thing as float:center;
I have some css issues. I'm trying to remove the space between a image and a label, and it does not work.
This is what I have:
And this is what I want:
I have problems with removing the space below he pictures and the same problem with the labels and the other div below them. In the same time I do not know how to position inline the headers from the footer.
This is my fiddle with my html and css:
https://jsfiddle.net/cwd6qw3o/
div img {
display: inline-block;
height: 30%;
width: 23%;
}
div.subtitle {
background-color: #333333;
color: white;
display: inline-block;
margin-top: 0;
text-align: left;
width: 23%;
}
div.subcolor {
background-color: #ba0927;
display: inline-block;
height: 5px;
width: 23%;
}
div.footer {
display: inline-block;
background-color: #e6e6e6;
width: 100%;
height: 5%;
}
Please tell me what i am doing wrong :).
Thanks !
I think it is not a good structure in your HTML,why not wrap your item in the same li such as
<ul>
<li>
<img src="~/Content/cont1.png"/>
<p>Bosch Car Service</p>
</li>
<li>
<img src="~/Content/cont2.png"/>
<p>Afspraak Proefrit</p>
</li>
<li>
<img src="~/Content/cont3.png"/>
<p>Afspraak onderhoud</p>
</li>
<li>
<img src="~/Content/cont4.png"/>
<p>Routebeschrijiving</p>
</li>
</ul>
You can remove spaces with the following CSS:
div {
font-size: 0;
}
div.subtitle {
font-size: 1rem;
}
Live preview: JSFiddle
Additional styling is necessary.
please try below code
div::after {
content: "";
width: 60%;
}
.image-div {
float: left;
width: 100%;
}
div img {
float: left;
height: 30%;
margin-right: 1%;
width: 23%;
}
div.subtitle {
background-color: #333333;
color: white;
float: left;
margin-right: 1%;
margin-top: 0;
text-align: left;
width: 23%;
}
.sub-div {
float: left;
width: 100%;
}
div.subcolor {
background-color: #ba0927;
float: left;
height: 5px;
margin-right: 1%;
width: 23%;
}
<body>
<img src="~/Content/slide1.png" id="slide" />
<div class="image-div">
<img src="http://dummyimage.com/200x200/000/fff"/>
<img src="http://dummyimage.com/200x200/000/fff" />
<img src="http://dummyimage.com/200x200/000/fff" />
<img src="http://dummyimage.com/200x200/000/fff" />
</div>
<div class="sub-div">
<div class="subtitle">
Bosch Car Service
</div>
<div class="subtitle">
Afspraak Proefrit
</div>
<div class="subtitle">
Afspraak onderhoud
</div>
<div class="subtitle">
Routebeschrijiving
</div>
</div>
<div>
<div class="subcolor" id="sub1"></div>
<div class="subcolor" id="sub2"></div>
<div class="subcolor" id="sub3"></div>
<div class="subcolor" id="sub4"></div>
</div>
<div class="footer">
<div class="images">
<img src="~/Content/fb.jpg"/>
<img src="~/Content/contact.jpg"/>
<img src="~/Content/route.jpg"/>
</div>
<div class="information">
<div class="contact">
<h1>Houman BVBA</h1>
<label>Boterstraat 6</label>
<label>B-2811 Hombeek (Mechelen)</label>
<label>Tel. 015 41 39 39</label>
<label>Fax. 015/43 24 40</label>
</div>
<div class="schedule">
<h1>Openingsuren</h1>
<label>Maandag: 9u-12u|13u-18u</label>
<label>Dinsdag: 9u-12u|13u-18u</label>
<label>Woensdag: 9u-12u|13u-18u</label>
<label>Donderdag: 9u-12u|13u-18u</label>
<label>Vrijdag: 9u-12u|13u-18u</label>
<label>Zaterdag: 9u-12u|13u-18u</label>
</div>
</div>
</div>
</body>