Website looks strange on mobile phone - html

My website looks strange on my Nexus 5 (see image below). Although I cannot test it, I guess this is the same for other mobile phones.
I guess this is because of the #media queries. However, if I try this on a normal pc with different screen widths, it looks like it should be.
Two questions:
how can I fix this?
Is there a way I can test this behavior on my pc, so I can use firebug to see the css?
This is how the #media queries look like in my css file:
#media (min-width: 600px) {
.col-lg-3 {
width: 50%;
float: left;
}
}
#media (min-width: 900px) {
.col-lg-3 {
width: 33.33%;
float: left;
}
}
#media (min-width: 1000px) {
.col-lg-3 {
width: 25%;
float: left;
}
}
#media (min-width: 1000px) {
.container {
max-width: 980px;
}
}
The .container is the white box with the shadow, and the .col-lg-3 are the product boxes (4 in a row on a normal screen).
The .container should fill the screen on small screens, and be 980px wide on a big screen. However, it looks much smaller, and it looks like the .col-lg-3 has a width of 100%

To elaborate #zazvomiki you can correct this behaviour by implementing the viewport meta tag and specifying that the viewport width should equal the width of the screen. Place the following in the element of your web page:
<meta name="viewport" content="width=device-width, user-scalable=no">
To answer the second part of your question can you test this behaviour on your PC you can use remote debugging with Chrome for Android which allows you to use developer tools from your PC to investigate the page on your phone. Then you can make live changes as you normally would in Chrome to test different ideas.
Remote debugging for Chrome: https://developer.chrome.com/devtools/docs/remote-debugging

Chrome has very good emulation tools for mobile built into the developer tools. See https://developer.chrome.com/devtools/docs/device-mode
The sub menu UL have defined widths also so this may be causing the menu bar to be forced wider that the container. Check the whitespace of the menu text as well.

Related

How can I make my container look nice on phone screens and not come out bad on desktop screens?

So I'm a newbie when it comes to bootstrap. I came across the web and found out that I can make my containers look the same on all screens by using this code?
#media (min-width: 1200px) {
.container-small {
width: 700px;
}
.container-large {
width: 1500px;
}
}
Can someone please explain this more to me and tell me how it works.
#media (min-width: 1200px) {
}
This tell to the PC, when the screen width is equal or less than 1200px the boxes you edited before in CSS are going to have a different behavior.
I mean if I have a div which width is 500px and, of course, in a cellphone doesn´t look good, you while using this metod of #media can change the size and behavior of your div and the elements that contains, without affect your original size in the desktop.
https://www.youtube.com/watch?v=6Yh8y0pVfQc&ab_channel=Flux
In this video is explained very well. I hope it can helped you!

Page width(resizing for all device)

i'm having issues with CSS for width and margin. I'm making a web page for all device(PC, smartphone and tablet), using HTML <meta name="viewport" content="width=device-width, initial-scale=0" >and Px(not auto or %) as unit for CSS.
By now, during window resizing(browser PC), elements still rest in their position(works page) but, on mobile(smartphone and tablet) it looks differents results:
Any comment or solution for that could be helpful, thanks.
UPDATE CODE: Page is built like this example https://jsfiddle.net/1wfr3vpq/ All classes property sets to "auto", were originally in px(example:width:1024px; or margin-left:150px;)
using media-query you can do this.
For example, you execute some CSS only for desktop computers using min-width
#media screen and (min-width: 800px) { /*The following CSS runs only for displays with a width (in pixels) of more than 800px*/
body {
background-color: lightblue;
}
}
#media screen and (max-width: 800px) { /*The following CSS runs only for displays with a width (in pixels) of less than 800px*/
body {
background-color: yellow;
}
}
Also, see this great link. https://css-tricks.com/css-media-queries/
with this you can get the idea

Mobile website version breaks depending on the orientation of device screen

A bit of background: I am a student who has volunteered to redesign a website that is used by my extra curricular robotics team. This is my first time creating and working with Bootstrap and responsive design in general and, in my opinion, everything has gone very smoothly up until I uploaded the website to a test domain and viewed it on a mobile device.
The issue I am facing deals with the width of the navbar and content on the website depending on the orientation of the device. While the device is in portrait mode (vertical), the navbar and content don't have enough space in the text, and as a result, make the page extremely long and take up a lot of space. On the other hand, when the device is landscape (on its side), the website is, at least what I would consider, completely fine:
http://imgur.com/gallery/toZYt (album because I cannot post more than two links right now, shows pictures of the issue in greater (visual) detail )
I've experimented with the viewport/initial scale of the webpage, and while that does change the navbar and content width, the navigation bar text/logo is squished in, and also looks relatively low quality. Changing the min/max-width of the media does not seem to do anything. I'm stuck as to how to fix this, and whether or not it is a #media issue or if has to do with my CSS for menu/content. I have a 125px margin for the content in my CSS main CSS, mainly for the desktop site to look nice, so maybe that has to do with something?
I tried to research this problem earlier on other posts and other websites, but I couldn't find anything that seemed to relate to my issue, and any suggestions didn't really fix/affect the website in a major way. I'm hoping that there is someway to fix this without affecting the other forms of the website (Landscape/Desktop), as well as the margin of the text/content.
I found that the problem persists on other phones (tested on a OnePlus X, iPod 5th Generation, and iPhone 6) but haven't been able to test it on tablets. If anyone has any suggestions for me that will solve this issue on the website, It will be greatly appreciated. Thanks for reading!
You need to look into CSS media queries.
There are a couple of things you should fix, including the 125px margin.
For example, that margin is way too big for a mobile device, so what you should do is:
.element {
margin: 0 15px; /* Default margin */
}
#media only screen and (min-width: 1024px) {
.element {
margin: 0 125px; /* Margin for displays > 1024px */
}
}
You can set multiple media queries that affect the same element. To build on the example above, you can have one more query # 1280px:
/* ... */
#media only screen and (min-width: 1024px) {
.element {
margin: 0 125px; /* Margin for displays > 1024px */
}
}
#media only screen and (min-width: 1280px) {
.element {
margin: 0 200px; /* Margin for displays > 1280px */
}
}
A good way to debug layouts at lower resolution is using your browser's built-in responsive view.
You can do that in all major browsers now, for example in Chrome you need to open up dev tools (Ctrl + Shift + I or Cmd + Opt + I) and click on the phone + tablet icon on the top left.
After I took a closer look at your website, I found some fixes you can apply to it in order to make it look better on smaller viewports:
1: (first remove .navbar-brand > img inline style (max-width and margin-top)
.navbar-brand img {
max-width: 200px;
margin-top: 14px;
}
#media only screen and (min-width: 440px) {
.navbar-brand img {
max-width: 350px;
margin-top: 7px;
}
}
2: Adjust border-control padding for smaller screens
.border-control {
padding-left: 15px;
padding-right: 15px;
}
#media only screen and (min-width: 768px) {
.border-control {
padding-left: 125px;
padding-right: 125px;
}
}
If this still doesn't make a lot of sense, I suggest you read up on media queries here and figure out how they work in depth.

Website reacts perfectly when testing responsiveness in developer tools, but isn't centered to screen on actual phone?

So I have a website that looks great when testing for responsiveness in developer tools, but isn't centered and looks somewhat broken when actually testing it on the iPhone itself.
What would cause this, and how can I fix it if I don't have access to an iPhone (looks fine on my android)?
See site here
The padding in this rule is the culprit, when you get rid of it you will see the difference:
#media screen and (max-width: 600px)
.tg-column-1, .tg-column-2, .tg-column-3, .tg-column-4 {
float: none;
padding-left: 34%;
}
To center the elements of text-widget you can try this instead of the padding you were using:
#media screen and (max-width: 600px)
.textwidget div { margin: 0 auto; }
}
Try to use overflow-x:hidden in body in css mediaquery for mobile. There is horizontal scroll in the website in mobile view, it may be the cause of your problem.

How to make a div snap to min or max size, without any sizes in-between?

I recently saw a link, on twitter, to path's new website; with.me. There's some pretty simple but neat things occurring on a with.me page, for example look at this one of Ashton Kutcher:
http://with.me/w/2275
My favorite thing on that page is how the picture appears to snap to a minimum and maximum size. When you resize the browse, you will notice that the image will eventually shrink to a smaller size in a "snapping" fashion. It doesn't resize with the browser, it instantly goes to the smaller size if the bigger one can't fit in the browser window.
How are they doing this? I've been poking around the CSS for the past two hours. I have a test page of my own that I've been trying to get this to work on, but can't figure it out.
Any ideas?
#ryan; it's a css3 media query .
if the check the link source then you saw he you it in there css
#media screen and (max-height: 720px), screen and (max-width: 850px) {
#page.permalink {
height: 454px;
margin: -247px auto 0 auto;
}
#page-container {
width: 650px;
}
#photo-container {
margin-left:-370px;
}
#photo {
height: 454px;
width: 340px;
background-size: 340px 454px;
}
}
check this
http://css-tricks.com/css-media-queries/
It's done by applying different stylesheets based on screen size:
#media screen and (min-height: 1000px) {
If you're using a webkit-based browser (safari / chrome), it actually animates between the two using a webkit animation.