How to know if the user is on mobile in css? [closed] - css

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
Improve this question
How to know if the user is on mobile in CSS?
I am making a mobile detector, but I don't know how to know the user on mobile. can you help me?

If I understand this correctly, you need to make that p tag disappear on mobiles and that is fairly simple.
Simply add another media query above the previous one but with a max-width of 767px like so:
#media only screen and (max-width: 767px) {
p {
display: none;
}
}
#media only screen and (min-width: 768px) {
p {
display:block;
}
}
Now, the p tag will be invisible in mobile view but visible on screens above 767px.

Related

How can I remove the padding on pages on mobile only [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 3 years ago.
Improve this question
Hello I cannot figure out how to remove the borders on my website in mobile only. I have huge padding that do not look good in mobile.
An example page
https://www.onlinematching.games/jewels-blitz/
Using CSS media queries.
You can control design for different devices using media queries.
Reference:- https://www.w3schools.com/css/css_rwd_mediaqueries.asp
as I checked your site all you have to do is change the width attribute of .container, .container-1400 in your style. there are more than one place to be changed(for every media queries).
codes below are for example:
#media only screen and (max-width: 767px) and (min-width: 480px){
.container, .container-1400{ width : 99%;/* 1% for margin */}
}

What is the most efficient way to have background images of different sizes in a responsive design website? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
I am building a responsive website. This website needs a lot of background images (both vector and raster formats).
I want to optimize the website for loading speed but not decrease picture quality.
My understanding is that I should have different versions for the same picture so that for small window devices the user automatically downloads the correct smallest file size.
My question is: What is the best way to deal with this problem? Do I need to use media queries? how to use them such that different browsers actually don't download unnecessary data?
Well, another post here on SO discussed if an unused css image url(''); is downloaded by the browser even if no element matches the rule. And it's been tested and established that on all major browsers, the images won't be downloaded unless an element actually matches the selector.
Post: Are unused CSS images downloaded?
It means that, if you define media queries for your styles, only the images inside rules that match the specific viewport will be downloaded.
In the following example, if you're in a device which is 480px wide or less, don't worry because large.jpg won't be downloaded.
#media (max-width: 480px) {
#myDiv {
background-image: url('small.jpg');
}
}
#media (min-width: 481px) {
#myDiv {
background-image: url('large.jpg');
}
}
Just reminding that this is a behavior left up to the browsers, so they can change anytime they want.

Centering Logo in Responsive site [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question appears to be off-topic because it lacks sufficient information to diagnose the problem. Describe your problem in more detail or include a minimal example in the question itself.
Closed 8 years ago.
Improve this question
I need that when the Wordpress responsive theme is resized, move the Logo image (initially in the left), to the center of its container.
This screenshot is from the div container CSS. I can see how width is variable.
EDIT: I'm using the Bootstrap theme, so this live demo might help, http://demo.opencodez.com/openstrap/
There is many ways to do that.
From the screenshot I can tell that your theme is using bootstrap and logo is placed within navbar (my guess) so you can see http://getbootstrap.com/components/#navbar
in case of top title:
#media (max-width: 767px) {
.logo-row > div {
width: 100%;
text-align: center;
}
.logo-row .img-responsive {
display: inline-block;
}
}

Div not showing up in responsive layout [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 9 years ago.
Improve this question
I have a responsive wordpress website which shows nicely on desktops. But somehow the whole layout is broken on smaller screens and the products div on homepage doesn't even display up there. .featured_products is the ul which you see on home page but it disappears as soon you resize your browser to smaller mobile size.
Here is my website.
It is because of a media queries in your stylesheet which starts at line 5811 in style.css
#media only screen and (max-width: 479px)
And then this part in the media query which starts at line 6149 in style.css
#subcontent2 {
display: none;
}
please change the code
#subcontent2{
display:none;
}
and also check this jsfiidle for your solution
http://jsfiddle.net/wpEwZ/

Fluid Design on Mobile Device [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
I am attempting to code a "semi-fluid" item for a mobile site and need a bit of help.
What I am looking to do is realign the layout when viewed vertical or horizontal.
When viewed vertically it should be...
Horizontal should be...
While it is a fairly rudimentary example, You can simply float the elements left when the screen is above a certain size. This is accomplished using a media query. You can assign media queries in CSS3 and can find the documentation here.
#media (max-width: 600px) {
#green, #red {
float: none;
}
}
Here is the jsFiddle for the simple solution.

Resources