CSS z-index not working properly on iphone - html

Hi I have this app on ionic where i have a big box where i put in amounts like this:
but on my iphone it shows it like this:
html:
<div class="wrapperz">
<!--DIT IS BOVENSTE STUKJE-->
<div class="productimagehead">
<img class="productimage" src="img/thumb_w800.jpg"/>
<h1 class="imagetext">Alle producten</h1>
<div class="menu" ng-click="menuToggle =! menuToggle"><img class="menuicon" src="img/button.svg" alt=""/></div>
<div class="cart"><img class="carticon" src="img/cartbuttonlight3.svg"/>
<div class="cartamount">{{cartamount}}</div>
</div>
</div>
</div>
<!--END BOVENSTE DEEL-->
<div class="tableheader">
<div class="plongtext"><p>Naam</p></div>
<div class="pmidtext"><p>Prijs</p></div>
<div class="prighttext"><p></p></div>
</div>
<!--BEGIN DE REST-->
<div class="productlist">
<div class="producttable">
<ion-content scroll="false">
<div ng-model="products" ng-repeat="p in products">
<div class="products" ng-class-even="'even'" ng-class-odd="'odd'">
<div class="productlongtext"> <p>{{p.name}}</p> </div>
<div class="productmidtext" ><p>€ {{p.price}}</p></div>
<div class="productrighttext" ><p> <a ng-click="showOrder = !showOrder"><img class="cartbutton" src="img/cart3.svg"/></a> <img class="info" src="img/info.svg" alt=""/></p></div>
</div>
<div ng-show="showOrder" class="z">
<div class="order" ng-click="showOrder = !showOrder">
</div>
<form name="amountForm" ng-submit="submitForm()" ng-controller="CartAddController" class="productform">
<input type="hidden" ng-model="productid" ng-init='productid = [this.p.id]' >
<div class="formproductname"><h2>{{p.name}}</h2></div>
<div class="formproductprice">Prijs: €{{p.price * amount}}</div>
<div class="formproductamount" prd-add ng-model="amount">
</div>
<div class="formproductadd">
<div class="formorderbutton">
<button type="submit" class="confirm" ng-click="$parent.showOrder = false"> Verstuur </button>
</div>
</div>
</form>
</div>
</div>
<div class="loadmore" ng-click="loadMore()"><p>Laad meer producten</p></div>
</ion-content>
</div>
</div>
I tried adding translatez(0), translate3d and did alot of things with Z-index but to no avail.
It works if i put the input form at the very top of my html but then i cant ng-repeat it.
CSS:
.wrapperz{
top: 0;
left: 0;
right: 0;
bottom: 0;
margin: 0;
padding: 0;
height: auto;
position: absolute;
}
.imagetext{
position: absolute;
width: 100%;
color: #ffffff;
bottom: 0;
float: left;
margin-left: 5%;
}
.productimagehead{
top: 0;
width: 100%;
height: 25%;
position: relative;
}
.productimage{
width: 100%;
height: 100%;
position: absolute;
background-size: 100% 100%;
}
.productlogo{
display: none;
}
.menuicon {
background: none;
height: 100%;
float: left;
margin: 0;
line-height: 0;
}
.cart {
position: relative;
height: 30%;
width: 15%;
margin-top: 5%;
padding-top: 5%;
float: left;
}
.carticon {
background: none;
height: 100%;
float: left;
}
.cartamount{
color: #ffffff;
position: absolute;
font-size: 70%;
margin-top: 10%;
right: 15%;
}
.tableheader{
background-color: #333333;
border: none;
height: 10%;
padding-left: 5%;
width: 95%;
position: relative;
top: 25%;
font-size: 100%;
}
.productlist{
width: 100%;
margin-left: 0;
height: 65%;
background-color: #ffffff;
position: absolute;
float: right;
top: 35%;
left: 0;
right: 0;
overflow-y: scroll;
-webkit-overflow-scrolling: touch;
}
.producttable{
width: 100%;
border: none;
font-size: 100%;
}
.products{
position: relative;
width: 95%;
padding-left: 5%;
height: 15%;
}
.order{
background-color: #3e3e3e;
opacity: 0.7;
height: 100%;
width: 100%;
position: fixed;
z-index: 999;
top: 0;
-webkit-backface-visibility: hidden
}
.productform{
top: 0px;
display: block;
position: fixed;
height: 30%;
width: 70%;
background-color: #252525;
color: snow;
margin-left: 15%;
margin-top: 40%;
z-index: 999;
}
.z{
z-index: 1000;
}

Not really a fix, but you can simply move that element (z) a little bit down, there is a lot of free space anyway ;)
Btw there is no z-index for tableheader class, i would suggest to put some z-index:-999 here.

Related

Div Element is Spilling of the Page Horizontally While the parent element is not

I have a div on my that contains pieces of information on my webpage. I'm having a problem where when the window gets smaller, part of the div gets cropped off the page.
Notes:
I have in my CSS inside my body element overflow-x: hidden;
The element that is spilling off the page contains a parent element. However, the parent element doesn't spill off the page.
View my code here
https://codepen.io/Tech-World/pen/ExLgNZq
Code added below:
scrollTo (0, 800)
body {
overflow-x: none;
}
.homepage-info {
position: absolute;
top: 1100px;
width: 100vw;
}
.why-heading {
text-align: center;
}
.info-blocks {
background-color: rgb(29, 31, 29);
height: 100px;
padding: 500px;
position: relative;
top: 50px;
padding-bottom: 300px;
max-width: 100%;
}
.info-block {
text-align: center;
background-color: rgb(204, 204, 204);
color: white;
width: 25%;
height: 200px;
padding: 30px;
margin: 50px;
border-radius: 10px;
}
#affordable {
position:absolute;
bottom: 500px;
left: 1245px;
}
#real-code {
position:absolute;
top: 400px;
left: 650px;
}
#in-person {
position:absolute;
bottom: 500px;
left: 40px;
}
#code-line-1 {
color: white;
position: absolute;
bottom: 825px;
left: 43.5%;
}
#code-line-2 {
color: white;
position: absolute;
bottom: 800px;
left: 35.5%;
}
<div class="homepage-info">
<h1 class="why-heading">Scroll down and shrink your window size</h1>
<div class="info-blocks">
<div class="fade-out info-block right-align " id="affordable">
<h2>Salve</h2>
<p>Test</p>
</div>
<div class="fade-out info-block left-align" id="real-code">
<h2>Hola</h2>
<p>Test</p>
</div>
<div class="fade-out info-block right-align" id="in-person">
<h2>Dobro</h2>
<p>Test</p>
</div>
</div>
Check below link for revised code.
https://codepen.io/nandujasthi/pen/zYjKzJz
Left of the div is mentioned in pixel with absolute position of element. Instead you can use the percentages to make it work efficiently in all the devices. Please check the link
body {
overflow-x: none;
}
.homepage-info {
position: absolute;
top: 10%;
width: 100vw;
left: 0;
}
.why-heading {
text-align: center;
}
.info-blocks {
background-color: rgb(29, 31, 29);
height: 100px;
padding: 500px;
position: relative;
top: 5%;
padding-bottom: 300px;
max-width: 100%;
}
.info-block {
text-align: center;
background-color: rgb(204, 204, 204);
color: white;
width: 25%;
height: 200px;
padding: 30px;
margin: 50px;
border-radius: 10px;
}
#affordable {
position:absolute;
top: 5%;
right: 10%;
}
#real-code {
position:absolute;
top: 45%;
left: 33%;
}
#in-person {
position:absolute;
bottom: 500px;
left: 10%;
}
#code-line-1 {
color: white;
position: absolute;
bottom: 825px;
left: 43.5%;
}
#code-line-2 {
color: white;
position: absolute;
bottom: 800px;
left: 35.5%;
}
<div class="homepage-info">
<h1 class="why-heading">Scroll down and shrink your window size</h1>
<div class="info-blocks">
<div class="fade-out info-block right-align " id="affordable">
<h2>Salve</h2>
<p>Test</p>
</div>
<div class="fade-out info-block left-align" id="real-code">
<h2>Hola</h2>
<p>Test</p>
</div>
<div class="fade-out info-block right-align" id="in-person">
<h2>Dobro</h2>
<p>Test</p>
</div>
</div>
</div>

Tag image with custom divs which shall stick to the picture

I'm trying to tag some divs to an image which shall stay in the right place as the window size changes.
It kind of works, but only until the image looses in height. How do I improve my code to make the markers always stick to the image.
You can perfectly see what I mean running the code in fullscreen.
.container-fluid {
padding: 5%;
background-color: #EDEDED;
}
img {
display: block;
width: 60%;
}
.marker {
position: absolute;
width: 35px;
height: 35px;
border-radius: 50%;
color: white;
background-color: rgba(0,0,0,.5);
text-align: center;
padding-top: 4px;
display: table-cell;
vertical-align: middle;
&::after {
padding: 5px 10px;
position: absolute;
top: -2px;
left: -2px;
border-radius: 10px;
background-color: rgba(0,0,0);
display: none;
content: attr(data-after-content);
width: 150px;
color: white;
font-family: "Zuric Light";
}
&:hover::after {
display: block;
}
}
.marker-one {
left: 43%;
top: 12%;
}
.marker-two {
left: 61%;
top: 39%;
}
.marker-three {
left: 49%;
top: 61%;
}
.marker-four {
left: 55%;
top: 77%;
}
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" rel="stylesheet"/>
<div class="container-fluid position-relative min-vh-100 d-flex justify-content-center">
<img src="https://firebasestorage.googleapis.com/v0/b/projektarbeit-interstuhl.appspot.com/o/pure%2Fpure_back_full_red.png?alt=media&token=02cac375-3340-4bc6-bbed-6ada0614a3f9" alt="Pure" class="align-self-center">
<div class="marker marker-one" data-after-content="Info">
+
</div>
<div class="marker marker-two" data-after-content="Info">
+
</div>
<div class="marker marker-three" data-after-content="Info">
+
</div>
<div class="marker marker-four" data-after-content="Info">
+
</div>
</div>
I assume you want a div to stay over top of an image on screen resize. To accomplish this, you can need to set a container around the image, which is set to the 60% width of the page container. Then, set this to position: relative. That way, the hover buttons are positioned using the percent of the total width of that container, not of the whole page.
New HTML
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" rel="stylesheet"/>
<div class="container-fluid position-relative min-vh-100 d-flex justify-content-center">
<div class="image-container">
<img src="https://firebasestorage.googleapis.com/v0/b/projektarbeit-interstuhl.appspot.com/o/pure%2Fpure_back_full_red.png?alt=media&token=02cac375-3340-4bc6-bbed-6ada0614a3f9" alt="Pure" class="align-self-center">
<div class="marker marker-one" data-after-content="Info">
+
</div>
<div class="marker marker-two" data-after-content="Info">
+
</div>
<div class="marker marker-three" data-after-content="Info">
+
</div>
<div class="marker marker-four" data-after-content="Info">
+
</div>
</div>
</div>
Updated CSS
.container-fluid {
padding: 5%;
background-color: #EDEDED;
}
img {
display: block;
width: 100%;
max-width: 100%;
max-height: fit-content !important;
}
.image-container {
width: 60% !important;
height: fit-content !important;
margin: 0 auto;
position: relative;
}
.marker {
position: absolute;
width: 35px;
height: 35px;
border-radius: 50%;
color: white;
background-color: rgba(0,0,0,.5);
text-align: center;
padding-top: 4px;
&::after {
padding: 5px 10px;
position: absolute;
top: -2px;
left: -2px;
border-radius: 10px;
background-color: rgba(0,0,0,0);
display: none;
content: attr(data-after-content);
width: 150px;
color: white;
font-family: "Zuric Light";
}
&:hover::after {
display: block;
}
}
.marker-one {
left: 38%;
top: 5%;
}
.marker-two {
left: 70%;
top: 36%;
}
.marker-three {
left: 46%;
top: 61%;
}
.marker-four {
left: 55%;
top: 80%;
}
This should work now! Hope it helps!

Absolute element not placing over relative element

Within my header, I am trying to place pending-button-notification over theimages-cart image. For some reason, the pending-button-notification div is showing on the left side of the header div.
Does anyone see why this isn't placing correctly?
This is the problematic code:
<div id="pending-order-button">
<a href="pendingOrders.html"><img src="images/cart.png" class="header-buttons" alt="Car">
<div id="pending-button-notification"></div>
</a>
</div>
header {
width: 100%;
max-width: 100%;
height: 100px;
position: relative;
border-bottom: 1px solid #E5E5E5;
}
#header-wrap {
width: 90%;
height: 100%;
margin: auto 5%;
}
#header-logo {
width: 200px;
height: auto;
position: absolute;
top: 50%;
transform: translateY(-50%);
}
.header-buttons {
width: 30px;
height: auto;
float: right;
margin: 30px 40px 0 50px;
cursor: pointer;
}
.header-buttons:first-child {
margin-right: 0;
}
#pending-order-button {
position: relative;
}
#pending-button-notification {
border-radius: 15px;
background: #09afdf;
height: 25px;
width: 25px;
position: absolute;
color: #FFF;
font-size: 1.3rem;
top: 5px;
left: 5px;
text-align: center;
}
<header>
<div id="header-wrap">
Logo
<img src="images/menu.png" class="header-buttons" alt="Pending Orders">
<div id="pending-order-button">
<a href="pendingOrders.html"><img src="images/cart.png" class="header-buttons" alt="Car">
<div id="pending-button-notification"></div>
</a>
</div>
</div>
</header>
It's your float:right on .header-buttons which is causing the problem.
I suggest that you remove that and float the #pending-order-button div instead so that it and all it's content is moved to the right.
#pending-order-button {
position: relative;
float:right;
}

Aligning divs underneath each other

I have this html:
<div id="container" class="container">
<div id="menu-top">
<div class="top-menu">
<div class="top-menu-buttons">
<button class="button button-icon ion-minus-circled"></button>
<span>{{amount}}</span>
<button class="button button-icon ion-plus-circled"></button>
</div>
</div>
</div>
<div id="classic" class="classic">
<div id="classic-img" class="classic-img">
<img ng-src="{{image.filtered}}" />
</div>
</div>
<div id="menu-bottom">
<div class="bottom-menu">
<div class="bottom-menu-buttons">
<button class="button button-icon ion-eye"></button>
<button class="button button-icon ion-refresh"></button>
<button class="button button-icon ion-crop"></button>
<button class="button button-icon ion-android-options"></button>
<button class="button button-icon ion-social-tumblr"></button>
</div>
</div>
</div>
</div>
And this css:
.container {
width: 100%;
}
.classic {
display: block;
position: relative;
margin-left: auto;
margin-right: auto;
background-position: center center;
background-image: url("../img/frames/postcard_00.png");
background-size: contain;
background-repeat: no-repeat;
}
.classic-img {
display: block;
position: absolute;
overflow: hidden;
width: 100%;
height: 100%;
top: 6%;
left: 5%;
}
.classic img {
position: absolute;
width: 100%;
height: 100%;
top: 0;
left: 0;
}
.top-menu {
position: relative;
width: 100%;
height: 50px;
background-color: red;
}
.top-menu-buttons {
position: absolute;
margin-left: auto;
margin-right: auto;
bottom: 0;
left: 0;
right: 0;
width: 50%;
text-align: center;
}
.top-menu-buttons .button {
display: inline-block;
vertical-align: middle;
font-size: 25px;
color: white;
}
.top-menu-buttons span {
display: inline-block;
vertical-align: middle;
font-size: 25px;
color: white;
}
.bottom-menu {
position: relative;
width: 100%;
height: 50px;
background-color: green;
}
.bottom-menu-buttons {
position: absolute;
margin-left: auto;
margin-right: auto;
bottom: 0;
left: 0;
right: 0;
width: 80%;
text-align: center;
}
.bottom-menu-buttons .button {
display: inline-block;
vertical-align: middle;
font-size: 35px;
color: white;
padding-left: 10px;
padding-right: 10px;
}
The result i want to have:
The result i got from above code:
My css is designed so that the blue content is under the red (top menu) and the green (bottom menu) is under the blue content. I cant find the mistake i made.
See this fiddle
position:absolute was the culprit.
You have to remove that from .classic-img and .classic-img img. Also, remove height: 100%; from .classic-img img. So the changed CSS would be as below
.classic-img {
display: block;
/* position: absolute; */
overflow: hidden;
width: 100%;
height: 100%;
top: 6%;
left: 5%;
}
.classic-img img {
/* position: absolute; */
width: 100%;
/* height: 100%; */
top: 0;
left: 0;
}
I'm not sure why you need an absolute position for both the image & the image container, if that is really necessary, you need to give the parent #classic a height.
Or you can remove the absolute positioning for the image & the image container like this
Or if you want the image to be fluid, just set it width to 100% instead of absolute positioning
.classic-img img {
width: 100%;
}
Try to give style rule position:absolute and bottom:0 to the .bottom-menu element. This will bring the .bottom menu at the bottom of page.
This will hopefully work for you.

Editor different to final product

I would like my div classes (.background_header, .background_content, .background_footer) to stack on top of each other during editing. In the link below you can see they stack fine, with the height of the header at 100vh and the content at 85vh, and the footer at 50vh.
http://www.hosting-mate.com/downloads/img1.png
In the image below however, when I want to edit it in dreamweaver, it displays COMPLETELY differently! I have tried setting the class position values to "relative" but that still doesnt work.
http://www.hosting-mate.com/downloads/img2.png
<style type="text/css">
body {
background-color: #191919;
margin-left: 0px;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
height: 100%;
width: 100%;
max-width: 100%;
overflow-x: hidden;
}
</style>
</head>
<!-- Content starts here -->
<body>
<div class="background_header">
<div id="header_bg">
<div id="border_l"><img src="http://www.hosting-mate.com/dkselectricalanddata/_assets/border_left_light.png" /></div>
<div id="logo"><img src="http://www.hosting-mate.com/dkselectricalanddata/_assets/logo_color_sml.png" /></div>
<div id="border_r"><img src="http://www.hosting-mate.com/dkselectricalanddata/_assets/border_right_light.png" /></div>
<div id="scroll"><img src="http://www.hosting-mate.com/dkselectricalanddata/_assets/scroll.png" /></div>
</div>
</div>
<div class="background_content">
<div id="content_bg">
<div id="border_content_top"><img src="http://www.hosting-mate.com/dkselectricalanddata/_assets/content_border_top.png" /></div>
<div id="form"></div>
</div>
</div>
<div class="background_footer">
<div id="footer_bg">
<div id="border_footer_top"><img src="http://www.hosting-mate.com/dkselectricalanddata/_assets/footer_border_top.png" /></div>
<div id="icons"><img src="http://www.hosting-mate.com/dkselectricalanddata/_assets/icon_phone.png" /><img src="http://www.hosting-mate.com/dkselectricalanddata/_assets/icon_email.png" /></div>
<div id="text"></div>
</div>
</div>
</body>
<!-- Content ends here -->
</html>
Below is my stylesheet code
#charset "utf-8";
img, object, embed, video {
max-width: 100%;
}
.ie6 img {
width:100%;
}
.background_header {
height: 100vh;
width: 100vw;
position: relative;
overflow: hidden;
display: block;
z-index: 100;
}
.background_content {
height: 85vh;
width: 100vw;
position: relative;
overflow: hidden;
display: block;
z-index: 50;
}
.background_footer {
height: 50vh;
width: 100vw;
position: relative;
overflow: hidden;
display: block;
z-index: 0;
}
#media only screen and (min-width: 769px) {
/* Header Content Starts*/
#header_bg {
position: absolute;
margin: 0;
height: 100%;
width: 100%;
max-width: 100%;
overflow: hidden;
}
#border_l {
position: absolute;
left: 0px;
top: 50%;
right: 75%;
width: 25%;
bottom: 0%;
overflow: hidden;
text-align: left;
}
#logo {
position: absolute;
width: 50%;
left: 25%;
right: 25%;
top: 37%;
bottom: 35%;
text-align: center;
}
#border_r {
position: absolute;
left: 75%;
top: 0%;
right: 0%;
width: 25%;
bottom: 50%;
overflow: visible;
text-align: right;
}
#scroll {
position: absolute;
width: 100%;
text-align: center;
bottom: 0px;
}
/* Header Content Ends */
/* Form Content Starts */
#content_bg {
position: absolute;
width: 100%;
height: 100%;
background-color: #FFF;
}
/* Form Content Ends */
/* Footer Content Starts */
#footer_bg {
position: absolute;
width: 100%;
height: 100%;
}
/* Footer Content Ends */}
Any help in this matter would be greatly appreciated.
Thanks!!