I don't have iPad, so i can't test properly, online simulators aren't reliable enough, it seems.
Problem: (client's words)
The site loads perfectly in both portrait and landscape. But, if I view in landscape, and then rotate the screen, the portrait view is off to the left as before, but not quite as bad.
Image: CENSORED NSFW IMAGE
Link: http://bybyweb.com/london (Warning: NSFW content)
Note: it happens in all browsers, except mercury.
I have used media queries for 'portrait' view, since iPad in landscape mode (1024px) should show desktop version properly.
CSS:
#media screen and (min-width : 767px) and (max-width: 1023px) {
#date h1 {
font-size:48px;
line-height:88px;
margin:-3px 0 0 340px;
padding:0;
color:#fff;
letter-spacing:0px;
word-spacing:0px;
font-weight:bold;
}
#joinform {
float: right;
width: 525px;
height: 500px;
left: 300px;
position: absolute;
z-index: 7;
padding-left: 5px;
padding-top: 6px;
overflow:hidden;
}
#member-login {
position:absolute;
left:470px;
top:15px;
}
#members-signup {
width:180px;
}
#members-area h2 {
line-height:30px;
font-size:30px;
margin:0 0 0 15px;
padding:65px 0 0 0;
font-weight:bold;
color: #454545;
}
#members-list {
width:500px;
height:220px;
float:left;
overflow:hidden;
}
#members-list h3 {
line-height:20px;
font-size:20px;
margin:0px;
padding:25px 0 5px 0px;
font-weight:400;
}
#content {
width:100%;
}
#about-area {
width:100%;
}
#about-area p{
width:90%;
}
#about-area h3 br{
display:none;
}
#about-area p br {
display:none;
}
#join-img-holder {
width:100%;
}
#members-area {
width:100%;
}
#logo-area {
width:100%;
}
#footer-content {
width:100%;
}
}
Complete page css link: http://bybyweb.com/london/css/style.css
What i am doing wrong?
P.S. Fix with position:relative didn't solved my problem, there is still a lot of empty space in 'portrait' view?! I would appreciate help. It is strange that issue occurs after orientation change.
And answer is: problem was width of one element - #joinform.
I have decreased width to 463px, and now all works fine.
It seems that overflow: hidden didn't work: iPad tend to 'show' hidden content, and to 'push' elements on page, if needed.
So, sum of widths shouldn't be more than 100% in any case, iPad doesn't tolerate it.
Also, i got good advice related to iPad testing - Google Chrome emulator (included in latest version) is very reliable (errors was visible in emulation).
I hope this will help to someone.
Related
I'm trying to get two images to display in a row, so I'm using a flexbox. I set the box's height to be 500px, but it almost* always calculates to be 0px. It reminds me of the issue with floating elements within, but I've tried this out with img {display:block} and by nesting the img tags in container divs, but neither seem to work.
= I say "almost" because when viewing on a test page in Chrome 49.0.2623.112 (but not my fiddle) and adjusting the viewport's width, right after the media query flips from the min-width:737px style to the max-width:736px style, the flexbox suddenly has height.
Here's a fiddle: https://jsfiddle.net/territorylit/6v4euuwL/
CSS
.popup_background {
position:fixed;
left:0;
top:0;
width:100%;
height:100%;
background-color:rgba(255,255,255,0.8);
z-index:100000000;
}
#media screen and (min-width:737px) {
}
#media screen and (max-width:736px) {
}
.popup_background img.button {
position:fixed;
right:0;
top:0;
width:50px;
height:50px;
border: none;
z-index:100000001;
transition:all 0.1s linear;
}
.popup_background img.button:hover {
border-right-style:solid;
border-right-color:rgba(175,0,175,1);
border-top-style:solid;
border-top-color:rgba(175,0,175,1);
}
#media screen and (min-width:737px) {
.popup_background img.button {
margin-right: calc(5% + 3px);
margin-top: calc(5% + 3px);
padding-top:5px;
}
.popup_background img.button:hover {
margin-right: calc(5% + 3px);
margin-top: calc(5% + 3px);
border-right-width:3px;
border-top-width:3px;
padding-right:3px;
padding-top:8px;
}
}
#media screen and (max-width:736px) {
.popup_background img.button {
padding-top:5px;
}
.popup_background img.button:hover {
}
}
.popup_container {
position:fixed;
top:0;
left:0;
bottom:0;
right:0;
display: -moz-box;
display: -ms-flexbox;
display: -webkit-box;
display: -webkit-flex;
display: flex;
justify-content:center;
align-items:center;
align-content:center;
flex-direction:column;
overflow-y:scroll;
background-color:rgba(255,255,255,0.9);
}
#media screen and (min-width:737px) {
.popup_container {
margin-left:5%;
margin-right:5%;
margin-top:5%;
margin-bottom:5%;
border-width:3px;
border-style:solid;
border-color:rgba(0,0,0,0.6); /* grey */
box-shadow: 0px 0px 3px 2px rgba(10,123,167,0.2); /* cerulean */
}
}
#media screen and (max-width:736px) {
.popup_container {
margin-left:3%;
margin-right:3%;
margin-top:3%;
margin-bottom:3%;
border-width:2px;
box-shadow: 0px 0px 3px 2px rgba(255,255,255,0.9); /* white transparent */
}
}
.popup_container.top_heavy {
justify-content:flex-start;
}
p.chelsea {
font-family:garamond,serif;
font-size:1.3em;
}
#media screen and (min-width:737px) {
p.chelsea {
max-width:70%;
line-height:140%;
}
}
#media screen and (max-width:736px) {
p.chelsea {
height:auto;
max-width:90%;
line-height:130%;
}
}
p.chelsea.footnote {
font-family:garamond,serif;
font-size:1rem;
text-align:right;
margin-bottom:1.5rem;
}
#media screen and (min-width:737px) {
p.chelsea.footnote {
width:50%;
}
}
#media screen and (max-width:736px) {
p.chelsea.footnote {
width:90%;
}
}
p.chelsea.translation {
font-size:1.2rem;
line-height:150%;
}
p.chelsea img {
width:100%;
}
.milky {
height:500px;
display: -moz-box;
display: -ms-flexbox;
display: -webkit-box;
display: -webkit-flex;
display: flex;
flex-direction:row;
justify-content:center;
align-items:flex-start;
align-content:center;
flex-wrap:nowrap;
overflow:hidden;
}
#media screen and (min-width:737px) {
.milky {
width:70%;
}
}
#media screen and (max-width:736px) {
.milky {
width:90%;
}
}
#rotation-01 {
flex:0.6;
}
#rotation-02 {
flex:1.5686;
}
HTML
<div id="section_04" class="section">
<div class="popup_background">
<img class="button" src="http://res.cloudinary.com/territory/image/upload/v1461522074/general/hr_grey_50x50.png" onclick="talkPopUpOff(this.id)" id="section_04_off" />
<div class="popup_container top_heavy">
<p class="chelsea"> </p>
<div class="milky">
<img id="rotation-01" src="https://static1.squarespace.com/static/557a4c2ee4b0fe5a537746b5/t/58b76175bf629a06758f0e2c/1488413284637/milky-way-rotation-1.jpg" />
<img id="rotation-02" src="https://static1.squarespace.com/static/557a4c2ee4b0fe5a537746b5/t/58b7618b8419c2a168e77ac6/1488413330003/milky-way-rotation-2.jpg" />
</div>
<p class="chelsea">“...in the absence of a bright star near the celestial south pole, Quechua peoples and their ancestors organized the sky by reference to the Milky Way, called Mayu or the “celestial river,” and its apparent cruciform rotations. In a twenty-four-hour period, the Milky Way forms two intersecting intercardinal axes that divide the heavens into quarters. Since the plane of the Milky Way is inclined in relation to the earth’s axis, the stars of one quarter will rise as those of the opposite quarter set as the earth rotates. Astronomical phenomena can be tracked with respect to these quarters, which create a systematic means for the spatial and temporal reckoning of the world and its natural and social rhythms. This principle is central to pre-Columbian spatial reckoning.”</p>
<p class="chelsea footnote">Gartner, William Gustav. "6· Mapmaking in the Central Andes." <em>Americas</em> 169 (1970): 647-54.</p>
<p class="chelsea"> </p>
</div>
</div>
</div>
Your problem is that .popup_container is a flexbox.
Simply change .popup_container to display: block, take the height off of .milky, and I believe it will behave as you would like.
Why?
The items within the .popup_container flexbox (such as your content, images, and footnote) automatically try to share all the vertical space, which is 100% of the display height, since .popup_container is a descendant of .popup_background, which has height: 100%. However, there is an exception. For some reason (if anyone knows why I'll be glad to include it), the text content takes precedence over the flexbox with the images. While the text gets to use up all the space it needs, the flexbox is reduced to barely anything. Your height property on the flexbox is obsolete because it is, itself, a flexbox item.
Also note: it's bad practice to have a fixed element the child of a fixed element, which is what you currently have. The inner element doesn't need to be fixed at all.
I have a shift calendar for a local fire department that I built using foundation5 responsive css framework. Everything works great when viewing in my browser and resizing the window.
example:
However, when I view this on an iPhone the calendar days are moved one block up.
Here is my css:
.calRow {
max-width:100%;
}
.calMonth, .calPrev, .calNext {
text-transform:uppercase;
font-weight:bold;
color:gray;
font-size:1.7em;
margin:15px 0;
text-align:center;
}
.calMonth {
text-align:center;
}
.calPrev {
text-align:left;
}
.calNext {
text-align:right;
}
.pCal ul li {
text-align:center;
height:0;
padding:0 0 14.28571%;
border-left:solid 1px gray;
border-top:solid 1px gray;
position: relative;
}
.pCal ul li:after {
content:'';
display: block;
margin-top: 100%;
}
.pCal ul li dl {
position:relative;
padding:0;
margin:0;
top:0;
height:100%;
}
.pCal ul li dl dt {
padding:0;
margin:0;
}
.pCal ul li.calHead {
font-size:0.8em;
border:none;
color:gray;
height:25px;
margin-bottom:-20px;
}
.calToday {
border-bottom:0.5em solid lightGrey;
}
.calDay {
position:relative;
padding:15%;
margin:0;
top:-100%;
}
.calLayer2, .calLayer3, .calLayer4 {
position:relative;
padding:0;
}
.calLayer2 {
top:-200%;
}
.calLayer3 {
top:-300%;
}
.calLayer4 {
top:-400%;
}
/* SHIFT HEIGHT / SIZE STYLES */
.shift2 {
height:50%
}
.shift3 {
height:33.33%
}
.shift4 {
height:25%
}
/* OVERLAY STYLES */
.calX img{
width:100%;
padding-top:2%;
}
.calCircle img{
width:100%;
padding:9% 7%;
}
.calSquare img {
width:100%;
padding:7%;
}
.pCal .calDayParts {
position: absolute;
top: 0;
bottom: 0;
width: 100%;
}
.pCal .calDayOverlay {
position: absolute;
top: 0;
bottom: 0;
height: auto;
width:100%;
}
.calLayer1, .calLayer2, .calLayer3 {
position: absolute;
top: 0;
bottom: 0;
width: 100%;
}
Can someone help me figure out why this is or at least suggest a way to debug it.
Thanks
EDIT 1 JS FIDDLE LINK
GO HERE for jsfiddle example - same issue is present when viewed on phone
side note, this answer has instructions on how to use iPhone over local network to connect to localhost of IIS on windows PC
It's difficult to debug without being able to inspect the site first hand. From first glance though, I would try adding a float and clear to the .calRow class, provided it is what it sounds like (the rows that make up the calendar).
.calRow {
float: left;
clear: both;
width: 100%;
}
Keep in mind by floating the calendar rows you will most likely need to also float the calendar container.
If that doesn't solve the problem it's most likely related to your absolute positioned elements not being positioned relatively to their parent element.
EDIT: I should add, if you have access to safari, an iPhone and a cord to plug the iPhone into your desktop. You can inspect the site using safari on your desktop by going to 'Develop' > 'iPhone'. More info on remote debugging here.
Okay,
so the problem was not with the css exactly. There were other styles bleeding into my styles. I placed this css inside an angular2 component and "encapsulated" the css, then it worked without the positioning error. It wraps the code in a shadow dom
I never did find out what style was bleeding into mine but the problem is now solved.
Before, we had a page looking like this
After we made some modifications we now have a page looking like this
For removing the empty spaces in the page, we did some coding as below.
We are using this code, but responsiveness of the site is gone after using the code below.
Please guide me as to what code changes are needed to maintain responsiveness.
.block.block-list.block-check-delivery{
position : relative;
bottom:85px !important;
}
.p{
float:none !important;
}
.usually{
position:relative;
bottom:90px !important;
}
.dinfo{
position:relative;
bottom:90px;
right:50px !important;
}
.catalog-product-view .add-to-cart-wrapper{
height: 60px;
width:45%;
float:right !important;
}
.sampleclass{
background: rgba(0, 0, 0, 0) url("../images/product_view_line.png") no-repeat scroll;
display: block !important;
}
.text-move{
position:relative;
bottom:21px;
font-weight:bold;
}
.font-move{
font-weight:bold;
position:relative;
bottom:2px;
}
.color-name{
font-weight:bold;
position:relative;
top:2px;
}
.text5{
position:relative;
left:10px;
}
Add the following style in your css and try
#media screen and (max-width: 960px) {
#aitcg_image_container13,
#raphBot_13,
#printable-area-image,
#raphTop_13
{
max-width:100% !important;
}
#aitcg_image_container13{
margin-left:0 !important;
}
}
I'm trying to match the dimensions, margins, text sizes, line height, etc of a web page to those of a word processor (in this case, OpenOffice) so that when you go to print the web page or make a PDF of it, it will look exactly like the document.
So far I've set the height and width to 11in/8.5in, every side margin to 0.79in, and the font is the same size as the document. (That is, if documents use pt.)
So how come it's only taking up half the page??
This site is made to be printed/PDF'd, so it doesn't have to use flexible values.
Thanks!
Here is a link to a sample document, I'll have some code soon
http://i.stack.imgur.com/l2Dl1.png
/*The rules go here*/
#page-container {
background: blue;
margin: 0.79in 0.79in 0.79in 0.79;
width: 7.5in;
height: 11in;
}
.name {
font-size:22pt;
font-weight:bold;
}
.sections {
margin: 10px 0 0 0;
font-weight:bold;
text-decoration:underline;
clear:right;
}
.jobtitles {
font-weight:bold;
}
.leftside {
float:left;
}
.rightside {
float:right;
width:50%;
}
.years {
float: right;
font-weight:bold;
padding-right: 1%;
}
.desc {
width: 760px;
}
ul {
list-style-type: none;
padding:0;
margin:0;
}
#footer {
text-align: center;
font-weight: bold;
}
The only reason its blue is so I can see the container.
Here an example http://jsbin.com/oqisuv/
CSS
body {
background:#e7ebf2 url(http://i.imgur.com/R2VB6.png) center repeat-y;
}
.menu {
width:989px;
margin:auto;
height:100px;
background:#666666;
line-height:100px;
text-align:center;
color:#fff;
}
HTML
<body>
<div class="menu">Hello</div>
</body>
If you view an example above on Google Chrome you will see the .menu looks like have a margin-left:-1px or margin-right:1px.
On Firefox & IE it's look great. How do I fix this one?
#media screen and (-webkit-min-device-pixel-ratio:0) {
html {
margin-left: 1px;
}
}
Background center with chrome (bug)
body {
background:#e7ebf2 url(http://i.imgur.com/R2VB6.png) 50% 0 repeat-y;
}
#media screen and (-webkit-min-device-pixel-ratio:0) {
body {
background-position: 50.001% 0;
}
}
http://philfreo.com/blog/fixing-safaris-1px-background-image-centering-problem/
Similar to rudsy's answer, but this one seems to work better:
#media screen and (-webkit-min-device-pixel-ratio:0) {
body {
background-position: 49.999% 0;
}
}
Set the body margin to 0 ...Try this css:
body {
background:#e7ebf2 url(http://i.imgur.com/R2VB6.png) center repeat-y;
margin: 0;
}
.menu {
width:990px;
height:100px;
margin: 0 auto;
background:#666666;
line-height:100px;
text-align:center;
color:#fff;
}
Chrome & firefox rendered differently it's better if you want result same in all browser the always give width in EVEN values not in ODD. So, write like this:
.menu {
width:990px;
}
Check this http://jsbin.com/oqisuv/2
UPDATED
If you want it's work perfect in chrome the you can use this:
#media screen and (-webkit-min-device-pixel-ratio:0) {
.menu {
width:990px;
}
Check this http://jsbin.com/oqisuv/5/
Most cross-browser and future-proof solution is to attach background to centered block itself (or to its centered parent that has horizontal padding for background to be visible on the outside of its child).
Attempts to achieve pixel-perfect matching of background and block centered independently (especially with hacks for specific browsers) is dead-end road.