Problems making elements fit for mobile first/media query - html
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%;
}
Related
Set width of all div elementes that are in same class as same
HTML div.section{ /*border style code is skipped on this post*/ background-color: #99CCFF; padding: 5px; margin-top: 10px; text-align: justify; text-justify : auto; overflow: hidden; } .topic{ /*border style code is skipped on this post*/ } p{ overflow: hidden; } img{ float: right; } div#navi{ /*border style code is skipped on this post*/ margin: 5px; width: 200px; color: gray; float: left; } div#navi h1{ text-align: left; padding-left:10px; } div#navi ul{ margin-left: 0px; } <div id="body"> <div id="navi"> <h1>Links</h1> <ul> <li>Lab.</li> <li>CSE # UNIV</li> <li>W3Schools</li> <li> Garden</li> </ul> </div> <div class="section"> <h2><span class="topic">Cars</span>: 67 Shelby Mustang GT500 Convertible</h2> <p> <img src="67eleanorConv.jpg" alt="1967 shelby Mustang GT500 Convertible" title="1967 shelby Mustang GT500 Convertible" /> something..something..something..something.. </p> </div> <div class="section"> <h2><span class="topic">Sports</span>: Snowboarding</h2> <p> <img src="daaa.jpg" alt="Travis Rice Snowboard Jump" title="Travis Rice Snowboard Jump" /> something..something..something..something..something.. </p> </div> <div class="section"> <h2><span class="topic">Music</span>: Funk & Punk Rock</h2> <p> <img src="lesPaulBass.jpg" alt="Gibson Les Paul Bass" title="Gibson Les Paul Bass" /> something..something..something..something.. <br/> <br/> something..something..something..something.. </p> </div> </div> Code is so long,so i delete the part of border style in css. I wrap div(id=nav) and div(id=section) into div(id=body) I set a size of div that is at left side of nav div using "overflow="hidden". but I can't set others. The layout with a second column must still be a liquid layout -- that is, all parts of it should adjust in size accordingly when the browser size changes. Here I post the link to the things I have and i want to: Result that I wanna make Current result of mine
The answer to your solution should be to set the navbar to absolute positioning. so that it will always extend the full height of the parent. Then you need to set position:relative to the parent div#body, Finally, the sections need to be adjusted to offset the navbar, so I do this by adding the CSS property margin-left:220px. CSS: div#navi { /*border style code is skipped on this post*/ margin: 5px; width: 200px; color: gray; position:absolute; top:0px; left:0px; bottom:0px; } div#body { position:relative; } div.section { /*border style code is skipped on this post*/ background-color: #99CCFF; padding: 5px; margin-top: 10px; text-align: justify; text-justify: auto; overflow: hidden; margin-left:220px; } div#body { position:relative; } div.section { /*border style code is skipped on this post*/ background-color: #99CCFF; padding: 5px; margin-top: 10px; text-align: justify; text-justify: auto; overflow: hidden; margin-left:220px; } .topic { /*border style code is skipped on this post*/ } p { overflow: hidden; } img { float: right; } div#navi { /*border style code is skipped on this post*/ margin: 5px; width: 200px; color: gray; position:absolute; top:0px; left:0px; bottom:0px; } div#navi h1 { text-align: left; padding-left: 10px; } div#navi ul { margin-left: 0px; } <div id="body"> <div id="navi"> <h1>Links</h1> <ul> <li>Lab.</li> <li>CSE # UNIV</li> <li>W3Schools</li> <li> Garden</li> </ul> </div> <div class="section"> <h2><span class="topic">Cars</span>: 67 Shelby Mustang GT500 Convertible</h2> <p> <img src="67eleanorConv.jpg" alt="1967 shelby Mustang GT500 Convertible" title="1967 shelby Mustang GT500 Convertible" /> something..something..something..something.. </p> </div> <div class="section"> <h2><span class="topic">Sports</span>: Snowboarding</h2> <p> <img src="daaa.jpg" alt="Travis Rice Snowboard Jump" title="Travis Rice Snowboard Jump" /> something..something..something..something..something.. </p> </div> <div class="section"> <h2><span class="topic">Music</span>: Funk & Punk Rock</h2> <p> <img src="lesPaulBass.jpg" alt="Gibson Les Paul Bass" title="Gibson Les Paul Bass" /> something..something..something..something.. <br/> <br/> something..something..something..something.. </p> </div>
Keep content inside footer
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/
CSS media queries min-width/max-width not being called
I've tried to fix this for hours and i'm pulling my hair out, no matter what i do it refuses to call the CSS in the media tag the instant i add max-width or min-width. To test, i made the media tag make the body red and reduced min-width to something ridiculously low. Nothing happens. If i leave the screen tag and nothing else, it calls it CSS: #import url("reset.css"); #charset "iso-8859-1"; #font-face { font-family: cooper; src: url('../resources/CooperBlackStd.otf'); } #media screen and (min-width:500){ body{background-color:#FF0000;} } body { line-height: 28px; } #pagecenter { margin-left:5%; margin-right:5%; background: #d1d1d1; /* Old browsers */ background: -moz-linear-gradient(left, #d1d1d1 0%, #66a8d2 20%, #66a8d2 80%, #e5e5e5 100%); /* FF3.6+ */ background: -webkit-gradient(linear, left top, right top, color-stop(0%,#d1d1d1), color-stop(20%,#66a8d2), color-stop(80%,#66a8d2), color-stop(100%,#e5e5e5)); /* Chrome,Safari4+ */ background: -webkit-linear-gradient(left, #d1d1d1 0%,#66a8d2 20%,#66a8d2 80%,#e5e5e5 100%); /* Chrome10+,Safari5.1+ */ background: -o-linear-gradient(left, #d1d1d1 0%,#66a8d2 20%,#66a8d2 80%,#e5e5e5 100%); /* Opera 11.10+ */ background: -ms-linear-gradient(left, #d1d1d1 0%,#66a8d2 20%,#66a8d2 80%,#e5e5e5 100%); /* IE10+ */ background: linear-gradient(to right, #d1d1d1 0%,#66a8d2 20%,#66a8d2 80%,#e5e5e5 100%); /* W3C */ filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#d1d1d1', endColorstr='#e5e5e5',GradientType=1 ); /* IE6-9 */ } /*No one needs to select the navigation bar*/ nav { width:100%; float:left; background-color:#0B61A4; border-bottom:3px solid #000; position:relative; -webkit-touch-callout: none; -webkit-user-select: none; -khtml-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none; } nav > ul { /*padding-left:10px;*/ display:block; list-style:none; position:relative; float:left; text-align:center; margin-left:15em; } nav > ul li { float:left; } nav ul li:hover{ background:rgb(63, 146, 210); } nav > ul li a { position:relative; height:100%; padding: 2px 3px; margin-bottom:3px; margin:0; display:block; color:#000; text-decoration:none; } nav ul:after { content: ""; clear:both; display:block; } nav ul ul { display:none; background:rgb(63, 146, 210); position:absolute; border-top:1px solid #000; border-bottom:1px solid #000; border-left:2px solid #000; border-right:2px solid #000; z-index:5; } nav ul ul li { float:none; border-top:1px solid #000; border-bottom:1px solid #000; height:50%; position:relative; } nav ul ul li a { color: #000; padding:15px; text-align:center; position:relative; font-family:cooper, times new roman, times, serif; } nav ul ul li a:hover { background-color: rgb(102, 163, 210); } nav ul li:hover > ul { display:block; } #logo { border-left:3px solid #000; border-right:3px solid #000; margin-left:-3px; padding:2px 3px; height:inherit; } #logo img { height:96px; } /*Navbar end*/ /*Butikk*/ table tr td { vertical-align:top; } #shoplist { width:100%; float:left; background-color:rgb(63, 146, 210); border-bottom:2px solid #000; } #shoplist ul { list-style:none; margin:0 8%; background-color:rgb(63, 146, 210); text-align:center; } #shoplist li { float:left; } #shoplist li a { position:relative; display:block; padding:8px 25px; text-decoration:none; height:100%; color:#000; font-family:cooper, times new roman, times, serif; border-right:2px solid #000; } #shoplist li:first-child a { border-left:2px solid #000; } /* Universal */ .bigbutton { position:relative; list-style:none; float:left; background-color:rgb(209, 209, 209); border:2px solid #000; margin:5px 5px; } .bigbutton li { float:left; height:auto; } .bigbutton li a { position:relative; display:block; padding:6px 6px 6px 25px; text-decoration:none; color:#000; font-family:cooper, times new roman, times, serif; } .bigbutton li img { height:32px; padding:0px 15px 0px 8px; } HTML: <!doctype html> <html><!-- InstanceBegin template="/Templates/maintemplate.dwt" codeOutsideHTMLIsLocked="false" --> <head> <meta charset="iso-8859-1"> <!-- InstanceBeginEditable name="doctitle" --> <title>Pedalsport</title> <!-- InstanceEndEditable --> <!-- InstanceBeginEditable name="head" --> <style type="text/css"> body,td,th { font-family: Arial, Helvetica, sans-serif; } </style> <!-- InstanceEndEditable --> <link href="css/main.css" rel="stylesheet" type="text/css"> <link rel="shortcut icon" href="img/favicon.ico"> </head> <body> <nav> <ul> <li><img src="img/Butikkicon.png" alt="Butikk"></li> <li><img src="img/verkstedicon.png" alt="tekst"></li> <li><img src="img/mapicon.png"> <ul> <li>Svartvann</li> <li>Brønnøya</li> <li>Bogstad</li> <li>Brunkollen</li> </ul> </li> <li id="logo"><img src="img/logo.png"></li> <li><img src="img/magasinikon.png"></li> <li><img src="img/klubbikon.png"></li> <li><img src="img/abouticon.png"></li> </ul> </nav> <!-- InstanceBeginEditable name="EditRegion1" --> <div id="shoplist"> <ul> <li>Barnesykler</li> <li>Temposykler</li> <li>Landeveissykler</li> <li>Terrengsykler</li> <li>El-sykler</li> </ul> </div> <div id="pagecenter"> <h1>Butikk</h1> <ul class="bigbutton"><li>Produktmagasin som PDF</li><li><img src="img/download.png"></li></ul> <a name="Barnesykler">Barnesykler</a> <table width="1061" border="0"> <tr> <th scope="col"> Dynamite 20’’ Girl 2013</th> <th scope="col"> </th> </tr> <tr> <th width="256" height="156" scope="row"> <img src="img/Jentesykkel.jpg" width="227" height="138" align="left"> </th> <td style="vertical-align:top;" width="795"> En pen og praktisk sykkel med fine farger. Perfekt for både landevei og terreng. Passer for jenter i alderen 8-12 år. <br> Pris: 1.699,- </td> </tr> <tr> <th scope="row">Fazer 16’’ Boy</th> <td></td> </tr> <tr> <th height="173" scope="row"><img src="img/Guttesykkel 16''.jpg" alt="Guttete sykkel" width="227" height="152" align="left"></th> <td>En tøff og holdbar sykkel som passer til de fleste anledninger med tøffe farger ogstøttehjul for de som trenger hjelp. Passer for gutter i alderen 6-10 år. <br> Pris: 1.799,- </td> </tr> <tr> <th scope="row">Superior Team Issue 24 Deore</th> <td></td> </tr> <tr> <th scope="row"><img src="img/Guttesykkel2.jpg" alt="http://www.birksport.no/images/birksport%20images/Superior%20Team%2024%20Issue.jpg" width="222" height="123" align="left"></th> <td> En god sykkel med gode bruksmuligheter; funker bra både på landeveien og i skog og mark. For de som er kommet forbi nybegynner. Passer for gutter og jenter i alderen 10-14 år. <br> Pris: 3.599,- </td> </tr> </table> <br> <hr> <h1><a name="Temposykler">Temposykler</a></h1> <table width="1063" border="0"> <tr> <th width="249" scope="col">Norcom Straight 1.1 2014</th> <th width="804" scope="col"> </th> </tr> <tr> <th scope="row"><img src="img/Temposykkel.jpg" alt="Temposykkel" width="219" height="146" align="left"></th> <td>En av markedes desidert sterkeste sykler, en temposyklers drøm. Sykkelen er utstyr med topnoch utstyr. Brukes av verdenseliten som Matt Reed og Cameron Dye. Pris: 49.999,-</td> </tr> </table> <hr> <h1><a name="Landeveissykler">Landeveissykler</a></h1> <h1>Fuji Altamira SL</h1> <img src="img/Landeveissykkel.jpg" alt="Landeveissykkel" width="201" height="121" align="left"> En flott landeveissykkel som har alt du er ute etter. Denne sykkelen veier bare 6.2kg! <br> Pris: 34.999,- <hr> <h1><a name="Terrengsykler">Terrengsykler</a></h1> <h1>Corratec Revolution carbon terrengsykkel</h1> <img src="img/Terrengsykkel1.jpg" alt="Terrengsykkel" width="191" height="128" align="left"> Forskjellen mellom god og perfekt. Denne sykkelen vil ta deg hvor du vil, når du vil og hvor fort du vil. Ypperlig til både konkurranse og for de som er ekstra dedikerte.<br> Pris: 14.199,- <h1> </h1> <h1>Corractec X-Vert S.04</h1> <img src="img/Terrengsykkel2.jpg" alt="Terrengsykkel2" width="188" height="118" align="left"> Perfekt sykkel, veldesignet for rundbane og mosjon. Lever opp til alle dine behov, både som mosjonist og som utdøver. En sykkel vi sterkt anbefaler. <br> Pris: 8.999,- <hr> <h1><a name="El-sykler">El-sykler</a></h1> <h1>Superior Powerflex 24 Men</h1> <img src="img/El-sykkel.jpg" alt="El-sykler" width="186" height="117" align="left"> Powerflex gir deg muligheten for et ekstra dytt opp den litt tunge bakken. En meget tilpasninsdyktig sykkel med 24V/ 250Watt motor og Panasonic Li-Ion 25,2 V PCB batteri.<br> Pris: 9.999,- <br> </div> <!-- InstanceEndEditable --> </body> <!-- InstanceEnd --></html> Excuse the absolute mess of code, but i haven't had time to clean this up before losing my mind over this issue.
You haven't specified a pixel value. Try: #media screen and (min-width:500px){ {body{background-color:#FF0000;} }
To expand on the previous answer, you didn't specify any unit, it doesn't need to be pixels. You could use absolute lengths ‘cm’, ‘mm’, ‘in’, ‘pt’, ‘pc’, or ‘px’, font-relative lengths ‘em’, ‘ex’, ‘ch’, or ‘rem’ or the viewport-percentage lengths: the ‘vw’, ‘vh’, ‘vmin’ or ‘vmax’. And that's just lengths, there are many other units you can use in media-queries including pixel density, device orientation, device type, etc.
Div background image wont show on mobiles
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 */ }
Two same div hover only one
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