Hi I am making a responsive site, and using media query for that following is my code:
(LINK)
#media screen and (max-width:960px){
/*Here Goes my code for screen size 960px */
}
#media screen and (max-width:700px){
/*Here Goes my code for screen size 700px */
}
#media screen and (max-width:625px){
/*Here Goes my code for screen size 700px */
}
I have given min-width to body as 250px
But still I am getting a horizontal scroll on Opera-mini, is there any other hack that I should I use to make media query work on opera mini.. this is the link if want to see on your opera mini mobile LINK
I had the same issue.You can make your body tag's overflow to hidden
Add this in your site's head tag, may be it will work: <meta name="viewport" content="width=device-width"/>
is it working ?
Related
I want to define a global width for all of my pages (e.g. using a wrapper, ...). If the browser is resized below this pre-defined minimum value, the scroll bar should appear and a further resizing of the images/text or splitting up a navigation bar into two horizontal lines, is not done.
Any html/CSS code is welcome.
Thanks
You can use a media query css for the same::
EG::
#media screen and (min-width: 320px) and (max-width: 767px) {
.wrapper {overflow: scroll;}
}
I have a (rather simple) website that I wish to automatically scale and adjust such that the main content area fits in the screen without horizontal scrolling on iPad. On Landscape mode it works fine, however on portrait mode it leaves out part of it on the side, and the user has to scroll horizontally.
It normally works fine for other websites I did, but for this one I can't understand what is stopping Safari from doing this.
I added the following line at the top of the HTML but it doesn't seem to have any effect (I tried various alternatives like adding the initial-scale=1.0 etc. too)
<meta name="viewport" content="width=device-width, maximum-scale=1.0" />
What could be the reason this is not working?
Clarification
I am not looking for a media query solution. I am just trying to understand why for some sites the iPad (and other touch devices) automatically scale down a website to fit on screen, while in this case something is causing it not to. I am just trying to identify the reason for it.
there is fixed width given for inner container
div#branding{
width: 1024px;
}
#content{
width: 1024px;
}
div#footer{
width: 1024px;
}
change all the 3 width to 100% for #media screen
more information on #media screens can be found here
#media only screen and (min-device-width : 768px) and (max-device-width : 1024px) and (orientation : portrait) and (-webkit-min-device-pixel-ratio: 2) {
div#branding {
width: 100%;
}
#content {
width: 100%;
}
div#footer {
height: 40px; /* remove height */
display: inline-block; /* change display:block to display: inline-block; */
}
}
and it will work
the right side footer content will come down as the left side content is more
screenshot
note : your footer will broke as fixed height is given you can remove it
for fixing your footer change css for footer
div#footer {
height: 40px; /* remove height */
display: inline-block; /* change display:block to display: inline-block; */
}
screenshot
I used width:100% and it solves my orientation layout situations, but there seems to be media queries that can help too:
#media screen and (orientation:portrait) {
/* Portrait styles */
}
/* Landscape */
#media screen and (orientation:landscape) {
/* Landscape styles */
}
Check this site out for more: http://www.1stwebdesigner.com/css/how-to-use-css3-orientation-media-queries/
Let us know if it works out.
Depending on rules you got in your CSS you will need to assign portrait mode such as landscape or portrait and add desired width also.
#media screen and (orientation:landscape) and (max-width:1024px){
some rules that will be applied to iPad in landscape mode
}
And big big difference is this, which will be applied on all 1024px screens
#media screen and (max-width: 1024px){
some css rules for "normal" screens on max-width: 1024px
}
EDIT:
So make sure that you put your "container" divs on 100% in various modes and adjust all other elements. the scrollbar you got is actually DOM element with fixed div or margins and paddings that affect width of whole page
I think the meta tag has a minimum scale besides the maximum:
<meta name="viewport" content="width=device-width, minimum-scale=1.0, maximum-scale=1.0">
What I don't know is if it will make any difference at this point.
It should work in theory, along with:
#media only screen and (min-width: 480px) {
/* landscape */
}
#media only screen and (max-width: 479px) {
/* portrait */
}
I finally figured out the problem. iPad (and most touch devices) actually scale the website automatically, without the need of the <meta name="viewport" ... > if the website is not explicitly designed to be responsive.
However, this scaling does not seem to work when the website is too wide. My content was 1024px wide, which for some reason was triggering the devices to turn off scaling.
I changed the content's width to 960px (I don't know the actual threshold, but my other site that scales well had this width) and the issue was immediately fixed.
Adding this answer in case someone is looking for a reason why scaling is not working on his site.
Obviously this is not related to having a responsive site, this is just when the website is simple and scaling is enough.
What I'm noticing is that Safari by default scales the web page automatically. However if the user manually applies some scaling - Safari stops its automatic scaling.
In my case this was the reason why it scaled some sites and others don't.
I'm developing a site that is 600 pixels wide and using responsive queries to make it fit in different devices. I'm using the following code:
<meta name="viewport" content="width=device-width" />
#media only screen and (min-width: 320px) and (max-width: 480px) {
/* iPhone */
.container { width: 100%; max-width: 480px; }
...
}
#media only screen and (min-width: 768px) and (max-width: 1024px) {
/* iPad */
...
}
I have a problem with the iPad, though. This device viewport is 768 pixels wide, and therefore the site renders correctly but is shifted to the left because its width is narrower.
My question is, is there a way to center the site or alternatively make it fill the whole iPad screen?
Thanks in advance
Try this:
<meta name="viewport" content="600" />
More on that here: https://developer.mozilla.org/en/docs/Mozilla/Mobile/Viewport_meta_tag
Or to centre the container (assuming it's 600px wide)
.container {
width:600px;
margin:0 auto;
}
Though it may be worth making the site larger in the first place.
Why make the site 600px wide? You should make the site fill the 100% of the viewport by default, and then adjust the margins around the content, font-size, the size of the images etc. for each screen size so that the content adapts.
You could take this site as example. If you try making the browser window bigger and smaller you'll see that all the content adapts (and even a mobile menu appears when the viewport is that small) All of that is accomplished using media queries for different screen sizes.
(Sorry about my syntax)
I'm encountering a problem on a website I'm developing: when I re-size the window to an horizontal resolution lower than 1170px both the navbar and the footer create gaps to the right of the page.
This also happens on mobile browsers (when zooming in the navbar shifts to the right making the last objects unreachable).
Could you kindly help me fix this problem?
HTML: http://pastebin.com/nTW3MrEr
CSS: http://pastebin.com/v1TDiK6J
Footer problem (Window Resized, the hero unit/navbar/and content are fine, but the footer still glitches, i've put some text to better understand the problem:
The problem with the website is because of the min-width:1100px set to hero-unit and width:1170px set to div #corpo. Since you are using container class to wrap up your content , in bootstrap responsive css the width is already 1170px so no need to set it there .
Also to rearrange your layout to be properly visible you can write media queries for specific sections of your page.
On your page on tablet view there is a big top margin between navigation and page-header so you can arrange them as belows like:
/* Landscape phone to portrait tablet */
#media (max-width: 767px) {
.navbar-fixed-top{
margin-top:5px;
}
.page-header{
margin-top:5px;
}
}
/* Landscape phones and down */
#media (max-width: 480px) {
.navbar-fixed-top{
margin-top:5px;
}
.page-header{
margin-top:5px;
}
}
When testing my responsive webpage in browsers by resizing the window and using simulators, everything was fine. Now I've just tested the page on my real iPhone 4S with strange results.
When loading the page in vertical view, everything is good, switching to horizontal view is also not a problem.
But when I turn the phone again so that it enters vertical view again, something strange happens. The vertical version is displayed, but it seems that the body does not properly resize. I get a big empty area on the right and a vertical scrollbar, while the elements on the webpage are displayed on the left. Screenshots:
Vertical #1
Horizontal
Vertical #2
This is the CSS code I have on my body (Note: I am still working on that project, so the colors and the font is only temporarily written like that):
body {
margin: 0;
background-color: grey;
color: black;
font-family: Georgia, serif;
line-height: 1.5;
background-image: url(../img/bg.png);
}
And I also use em based media queries, like:
#media only screen and (min-width: 30em) {
/* Stuff */
}
Inside the media queries I don't change anything on the body.
In the head of my HTML file I have
<meta name="viewport" content="width=device-width, initial-scale=1.0">
Some debugging showed me, that the body element resizes correctly, but the html element does not.
Do you have any idea what could cause that problem?
html:
<meta name="viewport" content="initial-scale=1.0">
try adding css:
#media only screen and (-webkit-min-device-pixel-ratio : 2) and (orientation:portrait),
only screen and (min-device-pixel-ratio : 2) and (orientation:portrait)
and,
#media only screen and (-webkit-min-device-pixel-ratio : 2) and (orientation:landscape),
only screen and (min-device-pixel-ratio : 2) and (orientation:landscape)
for retina displays.
maybe this link can help you https://developer.mozilla.org/en-US/docs/CSS/Media_queries
Ok, I finally figured this out! See this Question, it's the exact problem I am having.
HTML5 Placeholder Text Adding Width In Safari Causing Scrollbars And Flickering