all i am new here and i was trying to make responsive header image and to some extent i have done with using this "dislay none "technique
#img1{
display:block;
}
#img2{
display:none;
}
#media screen and (max-width:480px){
#img1{
display:none;
}
#img2{
display:block;
}
}
so this is the technique that i am using but it doesn't maintain the qualtiy what i think so can you please tell to make a header image responsive that is shorter than this method
thanks in advance
Why not use background images?
.header {
background: url(img1.jpg);
width: 100%;
height: 200px;
}
#media screen and (min-width: 768px) {
.header {
background: url(img2.jpg);
}
}
Related
this is a screenshot of my website
Hi! I am currently learning front end developing languages. I want to move my image to where the div.kitchen-image container is... but it will not move. My code at queries is this:
/*media queries*/
#media only screen and (max-width: 600px) {
nav{
display: flex;
flex-wrap: wrap;
line-height: 2;
}
.logo {
margin:0 auto;
}
.nav-links ul li a{
margin-left:15px;
}
.kitchen-image {
height:200px;
}
.main-pic{
width:400px;
}
}
tried changing the width and height of the image itself, but still no result.
You can use the CSS property transform: translate()
use this CSS in the Image's class
eg: The co-odinates given below are just an example.
.kitchen-image {
height:200px;
transform: translate(50px, 100px);
}
I have a responsive video on my page and I've set to to adjust to a static background image when the display reaches below 767px width (for smartphones).
Problem is, that anything between 768px to 1199px (width) eg. on iPads, my video DIV container height does not respond to, causing a white margin below the video. Ideally the container should adjust from 266px - 347px (height) in parallel with the video height/width.
.videobg is my container and .videoheader is the video itself.
Here is the code:
.videobg {
margin:0;
padding:0;
width:100%;
height:100%;
position: static;
z-index: -100;
min-height: 250px;
max-height: 423px;
}
.videoheader {
margin:0;
padding:0;
width:100%;
height:100%;
}
#media (max-width: 767px) {
.videobg {
background: url('images/home/header.jpg') center center / cover no-repeat;
height:266px;
}
.videoheader {
display: none;
}
}
#media(max-width:768px){
.videobg {
height:266px;
}
}
#media (max-width: 884px) {
.videobg {
height:280px;
}
}
#media (max-width: 1000px) {
.videobg {
height:347px;
}
}
For this certain case it looks that solution will be:
.videobg {
font-size: 0px;
}
I strongly recommend using other scaling for responsive videos (e.g. like this) and, oh dear, so many media queries! :D
But, duh, if it works for you it's fine.
Hello am having troubles to make this responsive mosaic, what I am trying to acomplish here is to keep the same order of the 7 images and if the screen is smaller make the mosaic full width but with their respective proportions in a mobile screen but maintaining the order.
this is my css:
#mosaic {
width: 100%;
background-color: aqua;
}
.largeImg, .smallImg {
/*display: inline-block;*/
float: left;
}
.largeImg {
/*width: 40%;*/
background-color: #165384;
}
.smallImg {
/*width: 60%;*/
background-color: #EF0808;
}
.col-wrap {
display: inline-block;
}
this is my demo: jsfiddle demo
Hope someone can help and thanks for reading.
You can achieve your desired functionality using media queries, the code below is specific for mobile devices, try it on;
#media all and (max-width: 658px) { // mobile devices
#mosaic {
display:block; // to have each musaic in one line
}
}
Hi I am almost finished with my website but I have a small issue of the columns not displaying at 100% when on a mobile device, I do not know what I have done wrong in the css below but the max-width 320px does not seem to be making the column go 100% when on mobile.
here is a link to my site to see what happens
http://www.ico.mmu.ac.uk/08506125/portfolio/index.html
I know it's a really simple solution...
#media(max-width : 320px){
.column.half { width: 100%;}
}
/* Column sizes */
#media (min-width: 40rem)
.column {
float:left;
padding-left:1em ;
padding-right:1em;
}
.column.full { width: 100%; }
.column.two-thirds { width: 66.7%; }
.column.half { width: 50%;}
.column.third { width: 33.3%; }
.column.fourth { width: 25%; }
.column.flow-opposite { float: right; }
/* Column sizes end */
/* Medium screens (640px) */
#media (min-width: 40rem) {
html { font-size: 112%; }
.third { float:left; display:inline;}
.half { float:left; display:inline;}
.two-thirds { float:left; display:inline;}
.image { border-style: double; border-color:white;}
}
/* Large screens (1024px) */
#media (min-width: 64rem) {
html { font-size: 120%; }
}
Just put this condition in the bottom because you override it with your default width.
.column.half { width: 50%;}
#media(max-width : 320px){
.column.half { width: 100%;}
}
please notice "half" class stop getting "float left" on 640px so you've got the issue already from there...because there are devices with bigger screen resolution, maybe it can be better for you to change 320px to 640px:
#media (max-width: 40rem){
.column.half
{
width: 100%;
}
}
I want to know how to size my images in #media screen and max-width:640.
My style.css:
#header-wrapper
{
position: relative;
padding: 7em 0 0;
background:url(images/fox-illustration.jpg) no-repeat center;
background-position:center;
width:auto;
height:768px;
}
My mobile.css:
#media screen and (max-width: 640px) {
header-wrapper {
width: 600px;
}
So the width is only applied to to the header-wrapper..
I also tried to give the header-wrapper in mobile.css another image
(which I sized in photoshop to mobile size).
But this didn't work either. I think because the image of the header-wrapper overwrite it in style.css?
background:url(images/fox-illustration.jpg);
background-size:600px 400px;
background-repeat:no-repeat;
Do this
First make sure your mobile.css is active.
If the second part of your code is at it is set now, you are probably missing an id tag in the css.
Try changing your
header-wrapper {
width: 600px;
}
to
#header-wrapper {
width: 600px;
}
Other than using fixed background size, you can use cover and follow the width of the #header-wrapper
#header-wrapper {
position: relative;
padding: 7em 0 0;
background:url(images/fox-illustration.jpg) no-repeat center;
background-size:cover;
width:auto;
height:768px;
}
#media screen and (max-width: 640px) {
#header-wrapper {
width: 600px;
}
}