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.
Related
I'm teaching myself html and css whilst at uni.
I'm trying to make a one page website, and am struggling trying to later the navigation bar over the title page. As eventually, i want the navigation bar to be mainstay on each page (which will be completed later in the project via javascript).
Can anyone point me in the right direction? I've attached some of the css code below.
Cheers
#import url('https://fonts.googleapis.com/css?family=Poiret+One');
a:link {
text-decoration: none;
}
a:visited {
color: white;
}
.Nav{
border:1px solid #ccc;
border-width:1px 0;
list-style:none;
margin:0;
padding:0;
text-align:center;
font-family: Poiret One;
}
.Nav li{
display:inline;
padding: 40px;
}
.Nav a{
display:inline-block;
padding:15px;
}
.Title-Page {
background-image: url("Images/Campeche.jpg");
background-size: cover;
padding: 200px 0 260px 0;
height: 600px;
margin: 0;
}
You need a position and a z-index to make this happen. You have to have the position for z-index to work. So here are 2 examples just remember to have your pages set up the same with a position but a lower z-index this will place the page below the nav bar. Hope it helps.
If you want it fixed while the page scrolls behind it.
.Nav{
border:1px solid #ccc;
border-width:1px 0;
list-style:none;
margin:0;
padding:0;
text-align:center;
font-family: Poiret One;
position:fixed;
z-index:90
}
If You want the Nav bar to scroll with the page.
.Nav{
border:1px solid #ccc;
border-width:1px 0;
list-style:none;
margin:0;
padding:0;
text-align:center;
font-family: Poiret One;
position:absolute;
z-index:90
}
Title Page with the position set and a lower z-index.
.Title-Page {
background-image: url("Images/Campeche.jpg");
background-size: cover;
padding: 200px 0 260px 0;
height: 600px;
margin: 0;
position:absolute;
z-index:50;
}
Are you able to use z-index to achieve this? Without an example to see it's a little tough. The z-index property specifies the stack order of an element (think of bring forward or backward).
Try something like this:
.Nav {
z-index:
}
If that doesn't bring the .Nav forward, try adding this as well:
.Title-Page {
z-index: -1;
}
You may have to adjust the #'s to get the best result. The higher the #, the closer it is to you.
Note: Position could also need adjusting here. Best to put this into something like codepen if the above doesn't work and post that link.
I have a carousel menu and i want to create a description box when you hover over each element. The problem is that when i put the position of it on absolute it does not show the whole description box that goes outside the div. When i put the position on absolute the description box scrolls down when i scroll down the page and i dont know what to do about it. Has anyone any idea how to solve this?
CSS
.carousel-component {
position:relative;
overflow:hidden; /* causes the clipping */
display:none; /* component turns it on when first item is rendered */
}
.carousel-component ul.carousel-list {
width:10000000px;
position:relative;
z-index:1;
}
.carousel-component .carousel-list li {
float:left;
list-style:none;
overflow:hidden;
}
.carousel-component .carousel-clip-region {
overflow:hidden; /* Secret to the clipping */
margin:0px auto;
position:relative;
}
/**
* ==============================================================================
* Safe to override. It is safe to override background, padding, margin, color,
* text alignment, fonts, etc. Define a separate CSS file and override your style
* preferences.
**/
.carousel-component {
/* padding:0px;*/
/* -moz-border-radius:6px;*/
/* color:#618cbe;*/
}
.carousel-component ul.carousel-list {
margin:0px;
padding:0px;
line-height:0px;
}
.carousel-component .carousel-list li {
text-align:center;
margin:0px;
padding:0px;
}
.carousel-component {
padding: 0px 16px; /*8px 16px 4px 16px;*/
margin:0px;
}
.carousel-component .carousel-list li {
margin:0px 10px;
width:78px; /* img width is 78 px + a.border-left (1) + a.border-right(1) + img.border-left (1) + img.border-right (1)*/
height:78px; /* image + row of text (87) + border-top (1) + border-bottom(1) + margin-bottom(4) */
/* margin-left: auto;*/ /* for testing IE auto issue */
}
.carousel-component .carousel-list li a {
display:block;
outline:none;
}
div.desc_box {
display: none;
border-radius:5px;
border: #000000;
position: absolute;
padding:0.5rem;
background: #000000;
color: white;
height:150px;
width: 450px;
margin-bottom: 25%;
overflow-x: visible;
-webkit-transform: translateY(1em);
transform: translateY(1em);
}
.carousel-component .carousel-list li img {
display:block;
}
.carousel-component .carousel-prev {
position:absolute;
top:20px;
z-index:3;
cursor:pointer;
left:5px;
}
.carousel-component .carousel-next {
position:absolute;
top:20px;
z-index:3;
cursor:pointer;
right:5px;
}
Html and Jquery
https://gist.github.com/teaxhillari/71f68a15c8820715e367
If you need to show your popup boxes on your page in a specific, non-scrolling position relative to the browser window then you can use position: fixed for instead of position: absolute. Fixed position positions it relative to the browser window, and so it won't move with scrolling. But, if you do need it to be positioned relative to a parent element, then this won't work because the parent element essentially becomes the browser window.
I have a search bar that works perfectly on Windows but not macs, we have had 3 different people try it out and they have reported back saying that the search bar is not in the right place
Here is how it should look: http://puu.sh/fxTdJ/a19ae11d62.jpg
And here are the styles:
#search {
position:relative;
top:-30px;
}
#search div {
padding-right:0;
}
#search button {
height:33px;
margin-top:1px;
background:#666;
color:#ccc;
border:1px solid #666;
border-radius:3px;
}
Here is the URL
http://178.62.26.90/essentialweddinghire/public/home
try giving clear:both to #search in your css:
#search {
clear: both;
position: relative;
top: -30px;
}
Nothing to do more Just Remove padding-left: 0; of .nav from your code
.nav {
padding-left: 0;
}
This issue looks in mozilla also Here.
I think this will help you. Also above answer is correct. Given by Era
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.
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.