I've been working on a landing page for a client and I've come across a problem when trying to keep my footer_content inside the footer
The all page is responsive but when it comes to the footer_content he just doesn't work. Right know I styled it back to px instead of % to have some functional work to show but if you guys could help m e make it responsive and block it inside the footer and would really appreciate it.
My code right now is:
<div class="foot">
<div class="foot_content">
<div class="foot_title">
<p style="font-size:18px; font-weight:bold; margin-left:auto; margin-right:auto">AS NOSSAS FUNCIONALIDADES<p>
<p style="font-size:12px; margin-left:auto; margin-right:auto; line-height:18px">Para o ajudar a encontrar os seus futuros clientes.<p>
</div>
<div class="foot_text_content">
<div class="foot_text_col_1">
<img src="img/pub.png" alt="publicidade" />
<p style="font-size:14px; font-weight:bold; margin-top:10px">GERIMOS A SUA PUBLICIDADE<p>
<div style="line-height:16px; margin-top:5px; font-size:14px">
<p>A nossa equipa de designers está<p>
<p>sempre pronta para dár resposta às<p>
<p>suas necessidades criativas.<p>
<p>Assim que resolvidas poderemos<p>
<p>ainda publicitá-las no nosso website.<p>
</div>
</div>
<div class="foot_text_col_2">
<img src="img/negocio.png" alt="negócio" />
<p style="font-size:13px; font-weight:bold; margin-top:10px">GERAMOS NEGÓCIOS<p>
<div style="line-height:16px; margin-top:5px; font-size:14px">
<p>O nosso website funciona como uma<p>
<p>rampa de lançamento para o seu negócio.<p>
<p>Através do “SEO” do nosso website,<p>
<p>garantimos que a sua publicidade<p>
<p>chegará a todos os seus clientes.<p>
</div>
</div>
<div class="foot_text_col_3">
<img src="img/success.png" alt="negócio" />
<p style="font-size:13px; font-weight:bold; margin-top:10px">GARANTIMOS SUCESSO<p>
<div style="line-height:16px; margin-top:5px; font-size:14px">
<p>Com todas estas ferramentas que<p>
<p>referimos, o seu sucesso será<p>
<p>garantido, resta-lhe apenas fechar<p>
<p>negócio.<p>
</div>
</div>
</div>
</div>
<div class="background">
<img src="img/foot_bg.png" />
</div>
and the css is
.foot {
position:absolute;
margin-bottom:auto;
bottom: 0;
width:100%;
height: 41.5%;
}
.background {
background: none repeat scroll 0 0;
height: 100%;
width: 100%;
bottom: 0;
margin-bottom:auto;
position:absolute;
}
.background img {
bottom: 0;
display: block;
left: 0;
margin: auto;
width:100%;
min-width:90%;
height: 100%;
min-height:41.5%;
right: 0;
top: 0;
z-index:-1;
}
.foot_content {
width:960px;
height:258px;
margin:auto;
bottom:20px;
left:0;
right:0;
position:absolute;
z-index:1;
}
.foot_title {
width:960px;
height:34px;
font-family: Arial, sans-serif;
text-align:center;
}
.foot_text_content {
width:960px;
height:193px;
margin-top:30px;
}
.foot_text_col_1 {
width:267px;
height:193px;
font-family: Arial, sans-serif;
text-align:center;
float:left;
}
.foot_text_col_2 {
width:267px;
height:193px;
font-family: Arial, sans-serif;
text-align:center;
float:left;
left:0;
right:0;
margin-left:auto;
margin-right:auto;
position:absolute;
}
.foot_text_col_3 {
width:267px;
height:193px;
font-family: Arial, sans-serif;
text-align:center;
float:right;
}`
Thanks in advance
EDIT Fiddle link as requested https://jsfiddle.net/wppo1bvo/
Related
I never finished my web-integrator education but i am now a mediagraphics intern and i offered to code a bit in css and html. So i am very rusty and this project has been just as much a refresher of knowledge as it has been a proper project. So be nice please.
I am making the site responsive however I am having a problem coding for the phone screen size.
To the right of my content the background image continues, allowing you to scroll sideways. I simply can't find out what's causing this. Images and everything are edited to fit the width there.
I have one suspicion, that I might have messed up completely with the width of the pixels. I have made it fit the screen but should i forget that and use the actual widths of the phone screen? Just seems so small and it appears to work fine with 1090px width here, it is just the background that push to the side.
This is my css code for the media query I am using for the phone.
#media only screen and (min-device-width : 320px) and (max-device-width : 480px) {
/* Splitters */
.splitter1 {
visibility: hidden;
height:0;
width:0;
z-index:1000;
}
.splitter1mobile {
visibility: visible;
height:250px;
width:1090px;
margin:0;
padding:0;
z-index:1000;
}
.splitter2 {
visibility: hidden;
height:0;
width: 0;
z-index:1000;
}
.splitter2mobile {
visibility:visible;
height:250px;
width:1090px;
margin:0;
padding:0;
z-index:1000;
}
.splitter3 {
visibility: hidden;
height:0;
width: 0;
z-index:1000;
}
.splitter3mobile {
visibility: visible;
height:250px;
width:1090px;
margin:0 0 7px 0;
padding:0;
z-index: 1000;
}
.splitter4 {
visibility: hidden;
width: 0;
height: 0;
}
.splitter4mobile {
visibility: visible;
height:250px;
width:1090px;
margin:-2px 0 0 0;
padding:0;
z-index: 1000;
}
.orangesplitter {
height:100%;
width:100%;
margin-top:-17px;
margin-bottom:-11px;
}
.greysplitter {
height:239px;
width:100%;
margin:-19px 0 26px 0;
}
footer {
width:86.5%;
}
.Element-header {
transform: translate3d(0,0,0);
}
.Element-header--fixed {
top: 0;
position: fixed;
}
/*------------- Body --------------*/
.fysphone {
margin-left:57px;
margin-top:112px;
visibility: visible;
width:56%;
height:45%;
}
.fysphone img {
visibility: visible;
width:100%;
height:500px;
}
.fysimgbox {
display:none;
}
.jonimgbox {
visibility: hidden;
width:0;
height:0;
}
.contentwrapper {
width:100%;
display:inline-block;
}
.textbox {
width:90%;
}
.jonimgboxphone {
margin-top:22px;
}
.jonnicephone {
margin:0 0 0 100px;
}
.jontitelphone {
margin-left:199px;
}
header {
transform: translate3d(0,0,0);
z-index: 1000;
padding:0;
margin:0;
width:1090px;
height:265px;
position:fixed;
box-shadow:0 5px 15px 0 #7d7b7c;
}
body{
padding:0;
margin:0 auto;
width:1090px;
height:8227px;
background-image: url(img/wallbgfadedphone.png);
background-repeat:repeat;
background-blend-mode: overlay;
}
.imgmbox {
margin-left:0;
margin-right:10px;
}
/*----- Google Maps -----*/
iframe {
margin-top:150px;
margin-right:20px;
width:500px;
height:350px;
}
.wrapper {
margin: 0 auto;
width:100%;
height: 8227px;
}
/*------------- Header ------------*/
/*------------- Header Navbar ------------*/
.Hnavbar {
margin-top:0;
height:101px;
width:100%;
box-shadow: inset 0 0 0 1000px rgba(125,123,124,.9);
background-image:url(img/wallbg.jpg);
}
.nav1 {
margin-left:-26px;
}
nav ul {
height:101px;
float:left;
margin:0;
width:100%;
}
nav ul li {
margin-left:30px;
margin-top:18px;
float:left;
height:30px;
list-style: none;
border-radius: 9px;
}
nav ul li a {
font-family:Exo;
color: #dedede;
padding:5px 23px 5px 23px;
border-top:1px solid #dedede;
border-bottom:1px solid #dedede;
text-decoration: none;
text-align: center;
font-size: 40px;
}
.fblink {
width:50px;
height:50px;
float:left;
margin-left:150px;
margin-top:15px;
display:none;
}
.fbicon:hover {
opacity:1.0;
}
/*** Content Block ***/
.contentblock {
width:100%;
height:1200px;
background-color:rgb(255,255,255,0.8);
display:inline-block;
opacity:0.9;
}
.contentblock1 {
width:100%;
height:1239px;
background-color:rgb(255,255,255,0.8);
display:flex;
opacity:0.9;
}
.contentblock2 {
display:inline-block;
width: 100%;
height:1971px;
background-color:rgb(255,255,255,0.8);
opacity:0.9;
margin-top:10px;
}
#contentblock3 {
width: 100%;
height:1120px;
background-color:rgb(255,255,255,0.8);
display:inline-block;
opacity:0.9;
}
/*** Anchor Menupoint Scrollpositioner ***/
.anchor {
display:none;
height:265px;
margin-top: -265px;
visibility:hidden;
}
/*** Om Text ***/
.textbox p {
font-family:Exo-Regular;
width:100%;
margin:0 auto 0 35px;
font-size:33px;
font-weight: 600;
color:#7d7b7c;
padding:0;
}
/*** Fys Text ***/
.fysbox {
font-family:Exo-Regular;
width:100%;
height:850px;
color:#7d7b7c;
padding:0;
}
.fysbox h2 {
font-size:40px;
margin-left:35px;
}
.fysbox p {
font-family:Exo-Regular;
width:90%;
margin:0 0 0 35px;
font-size:33px;
font-weight: 600;
color:#7d7b7c;
padding:0;
}
.fysbox ul li {
font-size:33px;
font-weight:600;
}
.textwrapper {
width:100%;
padding:20px;
}
/** Træning Text **/
.traeningbox p {
font-family:Exo-Regular;
width:100%;
margin:0 auto 0 35px;
font-size:33px;
font-weight:600;
color:#7d7b7c;
padding:0;
}
.traeningbox h2 {
font-size: 40px;
margin-left:35px;
}
.traeningbox {
width:90%;
}
/*---- Priser Text ----*/
.textboxpris {
float:left;
font-family:Exo-Regular;
width:350px;
margin:0 0 0 35px;
font-size:24px;
font-weight:600;
color:#7d7b7c;
padding:20px;
}
.textboxpris p {
font-size:33px;
}
.prish {
width:188px;
}
.pristext {
width:757px;
}
.textboxpris h2 {
font-size:40px;
}
.pristext {
font-size: 26px;
font-weight: 600;
margin-top:100px;
}
.prispunkt {
font-size:26px;
}
.textwrapperpris {
width:872px;
}
.textwrapperpris h2 {
}
.prisv {
float:left;
width:570px;
height:200px;
}
.prisimgbox {
visibility: hidden;
width:0;
height:0;
}
/*--- Kontakt text ---*/
.kontaktbox {
margin:0 0 0 98px;
float:left;
width:852px;
height:600px;
padding:0px;
font-family: Exo-Regular;
font-size:33px;
font-weight:600;
}
.kontaktbox h2 {
font-size: 40px;
}
iframe {
display:none;
}
.traeningimgbox {
visibility: hidden;
width:0;
height:0;
}
footer {
width:905px;
}
}
And this is my HTML
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Slagelse Sportsklinik</title>
<link rel="stylesheet" href="style.css">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>
<body>
<a name="top"></a>
<div class="wrapper">
<header>
<div class="Hlogobox">
<img src="img/logowhite.png" alt="">
</div>
<nav class="Hnavbar">
<ul>
<li class="nav1"><span>Home</span></li>
<li><span>Fysioterapi</span></li>
<li><span>Træning</span></li>
<li><span>Priser</span></li>
<li class="nav5"><span>Kontakt</span></li>
<a class="fblink" target="_blank" href="https://www.facebook.com/slagelsesportsklinik"><img class="fbicon" src="img/icons/facebook.png" alt=""></a>
</ul>
</nav>
</header>
<main>
<div class="contentblock1">
<div class="contentwrapper">
<div class="jonimgboxphone">
<img class="jontitelphone" src="img/jontitel.png" alt="">
<br>
<img class="jonnicephone" src="img/jonnice.png" alt="">
</div>
<div class="textbox">
<p>
<b>Slagelse Sportsklinik</b> startede i 2017 af fysioterapeut Jon Ahrensbøll med ønsket om at ville starte en klinik, der leverede hurtige og markante resultater, der skulle sikre hurtig tilbagevenden til idræt eller arbejde.
<br>
<br>
<span class="jonahrensboll"><b>Jon Ahrensbøll</b></span> har igennem 18 år arbejdet som fysioterapeut på forskellige klinikker med alle typer af patienter. De senere år har patientgruppen primært været idrætsfolk primært indenfor triatlon, løb og cykling. Jon Ahrensbøll er samtidigt tilknyttet Gørlev Fysioterapi og Idrætsklinik som fysioterapeut med fysioterapeutisk ansvar for både Vestsjællands Idrætsefterskole og Gørlev Idrætsefterskole.
</p>
</div>
<div class="jonimgbox">
<img class="jontitel" src="img/jontitel.png" alt="">
<img class="jonnice" src="img/jonnice.png" alt="">
</div>
</div>
</div>
<div class="orangesplitter">
<img class="splitter1" src="img/orangesplitter1.png" alt="">
<img class="splitter1mobile" src="img/orangesplitter1mobile.png" alt="">
</div>
<a name="fysmenu"></a>
<span class="anchor" id="section2"></span>
<div class="contentblock2">
<div class="totalwrap">
<div class="fysphone">
<img class="img" src="img/jonbrugerlaser.png" alt="">
</div>
<div class="fysbox">
<div class="textwrapper">
<h2>Fysioterapi</h2>
<p>
Hos Slagelse Sportsklinik udfører vi fysioterapeutiske behandlinger af høj kvalitet. Vi har en høj grad af information om både tests og behandling, og vi tillægger altid et holistisk perspektiv i vores behandlinger.
<br>
<br>
For at opnå størst mulig positiv effekt benytter vi forskellige fysioterapeutiske, osteopatiske og kiropraktiske manuelle teknikker, ligesom vi ofte inddrager forskellige former for træningsøvelser.
<br>
<br>
Udover manuelle teknikker og træningsøvelser benytter vi desuden bl.a.
</p>
<ul>
<li>IMS (Intra Muskulær Stimulation) dvs. behandling med nåle, hvorved bl.a. muskulatur afspændes hurtigt.</li>
<li>Kinesiotape, dvs. optapening med hyperelastisk tape, der på en gang støtter og bibeholder fuld funktion af både muskler og led.</li>
<li>High Power Laser, dvs. laserbehandling, der skaber en kemisk modulering af vævet, så opheling sker markant hurtigere</li>
</ul>
</div>
</div>
<div class="fysimgbox">
<img class="imgfys" src="img/jonbrugerlaser.png" alt="">
</div>
</div>
</div>
<div class="greysplitter"><img class="splitter2" src="img/greysplitter1.png" alt="">
<img class="splitter2mobile" src="img/greysplitter1mobile.png" alt="">
</div>
<a name="træningmenu"></a>
<span class="anchor" id="section2"></span>
<div class="contentblock3" id="contentblock3">
<div class="traeningbox">
<div class="textwrapper">
<h2>Træning</h2>
<p>
Hos Slagelse Sportsklinik tilbydes træning på små hold (max. 5 personer). Vi har forskellige former for holdtræning, og ens for dem alle er, at der er fokus på CORE, stabilitet og -ikke mindst- funktionalitet. Træningen er målrettet den enkelte deltager, således at alle uanset niveau vil blive udfordret.
<br>
<br>
Vi har valgt små hold ud fra ideen om, at på små hold er det intensiv, nærmest personlig træning samtidigt med, at man fortsat kan være social.
<br>
<br>
På alle hold benyttes styrke- og udspændingsøvelser hentet fra Pilates, Yoga og CORE, ligesom der benyttes træning i TRX, dvs. træning i slynger med egen kropsvægt som modstand.
</p>
</div>
</div>
<div class="traeningimgbox">
<img src="img/grittoneddown.png" alt="">
<img class="pushimg" src="img/stretch.png" alt="">
</div>
</div>
<div class="orangesplitter">
<img class="splitter3" src="img/orangesplitter2.png" alt="">
<img class="splitter3mobile" src="img/orangesplitter2mobile.png" alt="">
</div>
<a name="prismenu"></a>
<span class="anchor" id="section2"></span>
<div class="contentblock">
<div class="textboxpris">
<div class="textwrapperpris">
<h2>Priser</h2>
<p class="prisv">
Fysioterapeutisk behandling pr. gang <br><br>
Træning pr. gang <br><br>
Træningsklippekort - 10 gange <br><br>
Behandlingsklippekort - 10 gange <br><br>
</p>
<p class="prispunkt">
<b>•</b><br><br>
<b>•</b><br><br>
<b>•</b><br><br>
<b>•</b><br><br>
</p>
<p class="prish">
<b>kr. 275,00</b> <br><br>
<b>kr. 45,00 </b><br><br>
<b>kr. 400,00</b> <br><br>
<b>kr. 2500,00</b> <br><br>
</p>
<p class="pristext">
Slagelse Sportsklinik har <b>ikke</b> overenskomst med Den Offentlige Sygesikring, så tilskud hertil kan ikke opnås. Dette betyder samtidigt, at der ikke kræves henvisning fra egen læge for at kunne få behandling hos Slagelse Sportsklinik.
</p>
</div>
</div>
<div class="prisimgbox"><img src="img/transaction.png" alt="">
</div>
</div>
<div class="greysplitter">
<img class="splitter4" src="img/greysplitter2.png" alt="">
<img class="splitter4mobile" src="img/greysplitter2mobile.png" alt="">
</div>
<a name="kontaktmenu"></a>
<span class="anchor" id="section2"></span>
<div class="contentblock" id="contentblock5">
<div class="kontaktbox">
<h2>Kontakt</h2>
<p>
Du kan kontakte klinikken på følgende måder:
</p>
<ul>
<li><p><b>Telefon</b></p></li>
<li><p><b>Mail</b></p></li>
<li><p><b>Snailmail</b></p></li><br><br>
<li><p><b>Facebook</b></p></li>
</ul>
<ul>
<li><p>2844 0023</p></li>
<li><p>slagelsesportsklinik#gmail.com</p></li>
<li><p>Slagelse Sportsklinik <br>
Nytorv 4, 1. sal <br>
4200 Slagelse</p></li>
<li><a target="_blank" href="https://www.facebook.com/slagelsesportsklinik">www.facebook.com/slagelsesportsklinik</a></li>
</ul>
</div>
<iframe
frameborder="0" style="border:0"
src="https://www.google.com/maps/embed/v1/place?key=AIzaSyDXNF-E5Se1Suc6FWGmQWoH_bcpHoSwEEs
&q=Nytorv4+Slagelse,Slagelse+DK" allowfullscreen>
</iframe>
</div>
</main>
<footer>
<div class="footerleft">
<adress>Slagelse Sportsklinik</adress><br>
<adress>Nytorv 4, 1. Sal</adress><br>
<adress>4200 Slagelse</adress><br>
</div>
<div class="footerright">
<img class="footericon" src="img/icons/tlf.png" alt=""><adress>2844 0023</adress><br><br>
<img class="footericon" src="img/icons/mail.png" alt=""><adress>slagelsesportsklinik#gmail.com</adress><br><br>
<img class="footericon" src="img/icons/fbsort.png" alt=""><adress><a target="_blank" href="https://www.facebook.com/slagelsesportsklinik">www.facebook.com/slagelsesportsklinik</a></adress>
</div>
</footer>
</div>
</body>
</html>
Add to your container div, in this case wrapper, the following:
.wrapper {
overflow:hidden;
width:100%;
max-width:1200px; // or whatever you want
display:block;
margin: 0 auto;
}
This will contain everything inside your wrapper element and center it on the page for screen sizes greater than 1200px.
Also your header and body elements currently have fixed widths, you should remove the property from body, and give header a percentage-based width:
header {
width:100%;
}
I have been messing with this for hours and cannot figure out what the problem is.
I have a basic Local Weather App I've created for practice. When I add my footer to the bottom of the page it is automatically offset to the right from the center. Regardless of the position property set, I cannot use text-align:center or margin:auto to center the element.
HTML:
<div id='content-box'>
<div id='weather'>
<p id='temp'></p>
<p id='humidity' class='other'></p>
<p id='wind' class='other'></p>
<img id='icon' src=''>
</div>
<p id='location'></p>
</div>
<footer>FOOTER</footer>
CSS:
#content-box{
position:relative;
text-align:center;
width:33%;
margin:auto;
height:350px;;
background-color:rgba(0,0,0,0.1);
border-radius: 35px;
}
#weather{
font-size:3em;
}
#temp{
position:relative;
bottom:50px;
float:left;
font-size:3em;
font-family:Arial;
padding-left:20px;
color:#329555;
}
#temp:hover{
opacity:.8;
cursor:pointer;
}
span{
font-family:'Raleway', sans-serif;
}
.other{
font-size:.5em;
width:auto;
text-align:right;
padding: 10px 20px 0px 0px;
font-family:sans-serif;
}
#location{
position:absolute;
bottom:0px;
width:100%;
font-size:1.7em;
letter-spacing: 8px;
font-family:'Raleway';
}
#icon{
position:relative;
padding-top:10px;
display:flex;
float:right;
bottom:40px;
width:175px;
}
footer{
position:relative;
margin-top:50px;
}
My code is also on codepen, so it may be easiest for one to actually see the bug in action.
On the click event to convert Fahrenheit to Celsius it is also pushing the footer to the right, for which I am also lost as to why this is.
CODEPEN example,
What I had changed is,
footer{
position: relative;
clear:both;
}
and removed all the margins and paddings in body,
html, body{
height:100%;
margin:0;
padding:0;
}
Now you can even text align in your footer section too
footer{
position: relative;
clear:both;
text-align:center;
}
CODEPEN example for text-align
You can try this:
<footer>
<div style="
margin: 0 auto;
width: fit-content;
width: -webkit-fit-content;
">Code By Michael Ryan</div>
</footer>
It worked for me.
use clear: both;
The clear CSS property specifies whether an element can be next to
floating elements that precede it or must be moved down (cleared)
below them. The clear property applies to both floating and
non-floating elements.
var main = function(){
function getLocation(){
$.get('http://ip-api.com/json', function(loc){
$('#location').html(loc.city + ", " + loc.region + " " + loc.zip);
getWeather(loc.lat, loc.lon);
});
}
function getWeather(lat,lon){
var url = 'http://api.openweathermap.org/data/2.5/weather?lat=' +
lat + '&lon=' + lon + '&units=imperial' + '&type=accurate' +
'&APPID=ab4b9ad58133c89326de9f6ae59d7b66';
$.get(url, function(weatherInfo){
var temp = Math.round(weatherInfo.main.temp),
tempC = Math.round((temp - 32) * 5/9),
humidity = weatherInfo.main.humidity,
wind = weatherInfo.wind.speed,
icon = 'http://openweathermap.org/img/w/' + weatherInfo.weather[0].icon +'.png';
$('#temp').html(temp + '°<span>F</span>');
$('#humidity').html('Humidity: ' + humidity + '%');
$('#wind').html('Wind Speed: ' + wind + 'mph');
$('#icon').attr('src', icon);
$('#temp').click(function(){
if ($('#temp').text().indexOf('F') !== -1)
$('#temp').html(tempC + '°<span>C</span>');
else
$('#temp').html(temp + '°<span>F</span>');
})
});
}
getLocation();
}
$(document).ready(main);
html{
background:url('http://g01.a.alicdn.com/kf/HTB14WXBJVXXXXaSXFXXq6xXFXXXQ/Hot-Selling-Vinyl-4x5ft-Backdrop-Sunshine-Sea-Flowers-Photography-New-Portrait-Digital-Wedding-Backgrounds-1-25.jpg_640x640.jpg');
background-repeat:no-repeat;
background-size:cover;
}
body{position:relative;}
html, body{
height:100%;
}
header{
text-align:center;
font-size:2em;
letter-spacing:9px;
font-family:'Raleway', sans-serif;
}
h1{
opacity:0.45;
}
#content-box{
position:relative;
text-align:center;
width:33%;
margin:auto;
height:350px;;
background-color:rgba(0,0,0,0.1);
border-radius: 35px;
}
#weather{
font-size:3em;
}
#temp{
position:relative;
bottom:50px;
float:left;
font-size:3em;
font-family:Arial;
padding-left:20px;
color:#329555;
}
#temp:hover{
opacity:.8;
cursor:pointer;
}
span{
font-family:'Raleway', sans-serif;
}
.other{
font-size:.5em;
width:auto;
text-align:right;
padding: 10px 20px 0px 0px;
font-family:sans-serif;
}
#location{
position:absolute;
bottom:0px;
width:100%;
font-size:1.7em;
letter-spacing: 8px;
font-family:'Raleway';
}
#icon{
position:relative;
padding-top:10px;
display:flex;
float:right;
bottom:40px;
width:175px;
}
footer{
position:relative;
margin-top:50px;
clear:both;
}
footer .fix{
text-align: center;
}
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.2/jquery.min.js"></script>
<link href='https://fonts.googleapis.com/css?family=Raleway:300' rel='stylesheet' type='text/css'>
</head>
<body>
<header>
<h1>Local Weather App</h1>
</header>
<div id='content-box'>
<div id='weather'>
<p id='temp'></p>
<p id='humidity' class='other'></p>
<p id='wind' class='other'></p>
<img id='icon' src=''>
</div>
<p id='location'></p>
</div>
<footer><div class="fix">Code By Michael Ryan</div></footer>
</body>
</html>
Currently my parent div is showing up as a dimensionless div (0 by 0 px). I am trying to have a flexible parent div thats size is not explicitly mentioned but rather adaps to the size of its content. Here is what I have so far thats producing a 0px by 0px parent. Hope someone can give me a solution.
HTML:
<div class="thumbnailDeal">
<div class="thumbnailImage">
<div class="thumbnailDescription">
<span class="thumbnailTitle">3 Maki Orders</span>
<div class="thumbnailPrices"><span class="thumbnailOriginal">$25</span> $<span class="thumbnailActual">15</span></div>
<br>
<span class="thumbnailRestaurant">New Generation Sushi</span><br>
<span class="thumbnailLocation">11 St Joseph st.</span>
</div>
</div>
</div>
<div class="thumbnailDeal">
<div class="thumbnailImage">
<div class="thumbnailDescription">
<span class="thumbnailTitle">3 Maki Orders</span>
<div class="thumbnailPrices"><span class="thumbnailOriginal">$25</span> $<span class="thumbnailActual">15</span></div>
<br>
<span class="thumbnailRestaurant">New Generation Sushi</span><br>
<span class="thumbnailLocation">11 St Joseph st.</span>
</div>
</div>
</div>
CSS:
.thumbnailDeal{
display: inline-block;
margin:1%;
}
.thumbnailImage{
width:360px;
height:315px;
background-size: cover;
background-image: url(../assets/5.jpeg);
background-position: center center;
background-repeat: no-repeat;
position:absolute;
}
.thumbnailDescription{
height:28%;
width:100%;
background: rgba(0, 0, 0, 0.75);
position:absolute;
bottom:0;
padding:10px;
}
.thumbnailTitle{
color:white;
font-size:17px;
}
.thumbnailRestaurant{
color:#FD8B2B;
font-family: "Helvetica Neue",Helvetica,Arial,sans-serif;
font-size:14px;
}
.thumbnailLocation{
color:#9E9E97;
font-family: "Helvetica Neue",Helvetica,Arial,sans-serif;
font-size:14px;
position:absolute;
left:0px;
bottom:0px;
padding-left:10px;
}
.thumbnailPrices{
font-size:14px;
color:white;
position:absolute;
right:0px;
bottom:-13px;
box-sizing: border-box;
}
.thumbnailOriginal{
text-decoration: line-through;
color:#9E9E97
}
.thumbnailActual{
font-size:50px;
color:white;
position:relative;
right:10px;
}
When you use position: absolute elements get out of the flow and the parent won't have height/width from his childs anymore.
You have to find another way to position your elements if you want to have a proper height/width to the parent :)
I have a div class with a background image set. It displays ok on pc browsers but it wont show the image on mobile browser(i have tried android and ios)
the html
<div class="wrapper">
<div class="headerdiv">
<?php include '../inc/header.php';?>
</div>
<div id="wherewhen">
<div id="when">
<span class="wherewhen">WHEN IS IT?</span><br />
<span class="wherewhentext">9TH/10TH FEBUARY 2014</span>
</div>
<div id="where">
<span class="wherewhen">WHERE IS IT?</span><br />
<span class="wherewhentext">HOLIDAY INN, MILTON KEYNES, ENGLAND</span>
</div>
<div id="what">
<span class="wherewhen">WHAT IS IT?</span>
</div>
<div id="info">
<span class="wherewhentext">
A BACK IN THE DAY STYLE CONVENTION
FOR DISENFRANCHISED ARTISTS AND TATTOO FANS FED UP
WITH TODAY'S COMMERCIAL CORPORATE EXPOS.
</span>
</div>
</div>
<div class="poster">
</div>
the css
html, body{
margin:0;
padding:0;
width:100%;
height:100%;
overflow:auto;
background:#000000;
}
.wrapper{
width:80em;
margin: 0 auto 0 auto;
background:#000000;
overflow:hidden;
}
.poster{
float:left;
margin:-900px 0 0 910px;
width:370px;
min-height:600px;
background:#ffffff url('../images/siteimages/background.png');
}
#wherewhen{
background:#392da3;
width:600px;
margin:20px 20px 0 295px;
text-shadow: 2px -2px #000000;
}
#where{
float:left;
text-align:center;
width:20em;
}
#when{
float:right;
text-align:center;
width:15em;
}
#what{
width:20em;
text-align:center;
margin:0 auto 0 auto;
}
#info{
width:30em;
margin:0 auto 0 auto;
}
Can anyone offer assistance here?
Thanks...
oki, #poster background could be in #wrapper with background-attachement:fixed.
Else from your code (#poster outside #wrapper )
#wrapper {
position:relative;
z-index:1;
/* your rules */
}
#poster {
position:fixed;
z-index:0;
top:0;
left:0;
/* your rules */
}
I have a little problem with CSS hover...I have two divs in the same class but I wanna hover only one.
I already tried but it is not working and if it's working it changes for each color.
<div class="container iphone">
<!-- First box -->
<div class="span3 iphone-box-left">
======> <div class="quoteLeft"> <====== :hover
<blockquote>
<p>
description here
</p>
</blockquote>
<p class="credit">
johny
</p>
</div>
</div>
<!-- First box end -->
<!-- Second box -->
<div class="span6">
<img src="images/iphone.png">
<!-- Start Logo -->
<div class="logo-second">
<h3>
==============================================================
So when i hover on qouteLeft i wanna change the color on icon
this icon i also have in logo
====> <i class="icon-cloud icon-large"></i> <=================
creative
</h3>
</div>
<!-- Logo end -->
</div>
<!-- Second box end -->
CSS
.iphone {
position: relative; margin:50px auto; background:url(../images/11.png);
}
.quoteLeft {
position:relative;
top:40px;
padding:15px 25px 20px;
margin:20px auto;
font:italic 26px/1.4 Georgia, serif;
color:#fff;
background:rgba(34, 34, 34, .5);
}
.quoteLeft:after {
content:"";
position:absolute;
top:100%;
left:100%;
margin-top:-4px;
background:url(../images/box-line.png) no-repeat;
width:150px; height:165px;
}
.quoteRight {
position:relative;
top:150px;
padding:15px 25px 20px;
margin:20px auto;
font:italic 26px/1.4 Georgia, serif;
color:#fff;
background:rgba(34, 34, 34, .5);
}
.quoteRight:after {
content:"";
position:absolute;
top:100%;
right:80%;
margin-top:-4px;
background:url(../images/box-line-2.png) no-repeat;
width:300px; height:165px;
}
.credit {
margin:1em 0 0;
font:14px/1.2 Arial, sans-serif;
}
.credit:before {
content:"— ";
}
blockquote, p {padding:0; margin:0;}
.logo-second { position:absolute; margin-top:-20%; margin-left:11%;}
.logo-second h3 { font-size:56px;}
.quoteLeft:hover {And....}
I prefer any ideas css or jquery
Thanks
I think this is what you are looking for:
HTML
<div class="main">
<div class="first">First</div>
<div class="second">Second</div>
</div>
CSS
.main .first:hover ~ .second {
background-color: #f00;
}
I also made a jsFiddle