This question already exists:
HTML desktop and mobile [closed]
Closed 3 years ago.
https://jsfiddle.net/5d401nso/1/
#mobileview{
/*background-image:url("");
background-size:100% 100%;*/
width:auto;
height:auto;
}
#media(max-width: 768px){
#mobileview{
width:411px;
height:411px;
}
}
#media(max-width: 500px){
#mobileview{
width:411px;
height:411px;
}
}
Above is the jsfiddle that i have created.
Current Problem: Not Supporting Mobile View and looking a ways to
change the text and button alignment from center to "left" when in
mobile view
Solution That i wanted: When in mobile view ( max width 768px or 500px ), the text and button will align to left side instead of center.
Put p { text-align: left } inside your #media {} at whatever breakpoint you want it to happen. However small tipp. To make it even more responsive give your image a max-width instead of a static width, so your image will resize whenever your screen does. Also note you have the exact settings for 500 and 700px. If you say #media(max-width: 700px) it will apply to every thing wich is smaller than 700px. You don't need to define 500px if your want 500px down. If you want something to happen within 500px and 700px us (min-width: 500px) and (max-width: 700px)
#media(max-width: 500px){
#mobileview{
max-width: 100%;
height: auto;
}
p {
text-align: left;
}
}
Related
I have a web project, how do I make the images on my website responsive in any display? Will this is my code is produce an error?
html code
<img src="image/Al-Khawarizmi.jpeg" class="img-load">
css code
#media screen and (max-width: 750px) {
.img-load {
width: 100%;
height: auto;
}
}
You have a few options when it comes to making your image responsive.
With the current settings you have of width: 100% and height: auto, your image is already responsive without the media query.
Your image is not longer responsive if you start using px as a unit of measure for your height and width.
You do haven't need to #media, if you want image width to cover the entire page width, in any device. only:
HTML:
<img src="image/Al-Khawarizmi.jpeg" class="img-load">
CSS:
.img-load{
width:100%;
}
You must use #media, only when you want your image to have different widths in any device.
For example, if you want the width of an image to be 50% on the large screen, and 100% on the smaller screen, you can set:
CSS:
.img-load{
height: auto;
}
#media screen and (max-width: 750px) {
.img-load{
width:100%;
}
}
#media screen and (max-width: 1200px) {
.img-load{
width:50%;
}
}
I am trying to make a responsive webpage with my site here: https://chunzg.github.io/about.html
I have made a flex container for the photo and text.
Have used the media query below to first test on my laptop screen :
#media only screen
and (min-device-width: 300px)
and (max-device-width: 600px)
and (-webkit-min-device-pixel-ratio: 2) {
.sidebar {
width: 100%;
}
.photo {
width: 100%;
}
.text {
width: 100%;
}
}
but it doesn't work - nothing changes. I would like the sidebar, photo and text to be stacked vertically on top of one another if I am looking at it on a narrow screen.
I know I must be doing something wrong but just don't have enough experience to know what needs to change
Thanks
Hey I am giving a reference:https://www.w3schools.com/css/css3_mediaqueries_ex.asp
I couldnt understand the exact question but I think it should be like this:
/* On screens that are 992px wide or less, go from four columns to two columns */
#media screen and (max-width: 600px) {
.sidebar {
width: 100%;
}
.photo {
width: 100%;
}
.text {
width: 100%;
}
}
In my code I scripts lets webpage to change width by 100 if the screen size is less than 600 or equal to 600.(Maybe it can be usefull for your ipad or small devices screen)
Also why did you used min and max at the same time?
Note that I am not professional but I have had some experiences with css so that my answer maybe could not be the solution. But lets try this.
This question already has answers here:
How to override the width property?
(7 answers)
Overwrite HTML width property with CSS
(3 answers)
Closed 4 years ago.
I have the following:
<style>
.some_photos { width: 358px; }
#media only screen and (min-width: 1040px)
{
.some_photos { width: 700px; }
}
</style>
When the screen width of the device/browser is greater than 1040px I need .some_photos to resize to it's original image size because the photo may physically not be 700px wide in some cases. Photos will not be smaller than 358px but when some photos that is 400px for example resizes to 700px it does not look very good. I would rather display the image in it's original size. (400px for example)
This style sheet is used in a script that displays images in a gallery. The images that are bigger than 700px may not display bigger than 700px when the device/browser resolution is 1040px or higher.
I can't seem to find a CSS solution to resize the image to it's original size when the device/browser is larger than 1040px.
I have tried .some_photos { max-width:100%; height:auto; } when the device browser resolution is bigger than 1040px but that is not working.
Have you tried:
.some_photos
{
width: auto;
height: auto;
}
I'd tried this according to your needs description
.some_photos { width: 358px; }
#media only screen and (min-width: 1040px)
{
.some_photos { width: auto; max-width: 700px; }
}
I give my div elements sizes in % because I want them to be able to adapt to different screen sizes of different devices. I however want the size to be constant for a device. For example if a div is 60% in width of my laptop browser screen it should stay 60% even when I minimize size of my browser window.
How do I achieve this?
You are probally looking for
min-width: 800px;
If the width gets under 800px now the div wont resize smaller and just stay at this width.
Just make sure you add a media query like this:
div{
width: 60%;
}
#media (min-width: 601px) {
div{
min-width: 800px;
}
}
#media (max-width: 600px) {
div{
min-width: 400px;
}
}
Using % you can make the div adaptive, but inside side the div if there any image or fixed width elements it will not be adaptive, you need to make them adaptive using media queries
ex:
/* Small Mobile Devices ( < 768px ) Style Begin */
#media (min-width: 0px) and (max-width: 767px) {
.div-elements-name {
width:100%;
}
}
Hi I'm fairly new to bootstrap and what I'm trying to achieve is to have a jumbotron on top of my page with different paragraph formatting to accommodate for a background image which takes lets say 30% of full width space.
I have offset my text by padding-left: 300px; and it looks fine on desktops but this rule also applies to a paragraph in mobile device mode resulting it being very skinny and tall.
Is there a way where I can set lets say 3 different paragraphs each showing under certain screen size?
Just use media queries:
#media screen and (max-width: 320px)
{
p{
padding-left: 0;
}
}
#media screen and (min-width: 321px) and (max-width:800px)
{
p{
padding-left: 100px;
}
}
#media screen and (min-width: 801px)
{
p{
padding-left: 300px;
}
}