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.
Related
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.
So I have been trying to figure this out for a day or so without any luck, and figured I would turn to the CSS masters of the universe here.
Anyway, in Chrome my page looks fine (like always), but Firefox and IE both seem to have issues w/resizing images. I basically have 2 parts, a 'left div' and a 'right div', and the on the left just has right-padding to make it be the entire width, minus the width of the 'right div'.
Inside 'left div', there is an image who's size is set to be 100% of the width and height of the containing element, which in Chrome, works out wonderfully, and leaves the image in the center and looking good. FF and IE don't resize it at all, and worse, they don't respect the padding set on 'left div' so it looks even more weird.
The simplified HTML:
<div>
<div class="dialog-bg"></div>
<div id="view-larger-dialog" class="mc_report_dialog dialog-container">
<div class="details-container staticimage">
<span id="openPostModal">
<span class="modal-body cardDetails">
<div class="closeOpenModal">×</div>
<div class="cardContent">
<div class="cardBody">
<div id="card-content" class="card-content-staticimage">
<span class="image">
<img class="annotatable" src="https://s-media-cache-ak0.pinimg.com/originals/5a/28/22/5a282241e64e41d605384bb261ea581f.jpg">
</span>
</div>
</div>
</div>
</span>
</span>
<span class="detailBox">
<div class="cardContent cardDetails">
<div class="content">
<p>
blank white space
</p>
</div>
</div>
</span>
</div>
</div>
</div>
The CSS:
.dialog-bg {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: black;
opacity: 0.6;
z-index: 1001;
}
.mc_report_dialog .details-container {
padding: 0px;
}
span#openPostModal {
position: fixed;
top: 0;
left: 0;
height: 800px;
margin-top: 0px;
margin-left: 0px;
display: table;
z-index: 5000;
height: 100%;
background: none;
width: 100%;
box-sizing: border-box;
padding-right: 24rem;
border: none;
}
span.detailBox, span.shareNewBox {
width: 24rem;
height: 100%;
padding: 0;
position: fixed;
top: 0px;
right: 0px;
background-color: white;
z-index: 5005;
}
span#openPostModal .modal-body {
border: 0px solid #ffffff;
padding: .6rem 1rem;
display: table-cell;
vertical-align: middle;
width: 100%;
max-height: 50%;
background: none;
overflow-y: visible;
}
.closeOpenModal {
font-size: 2rem;
color: #fff;
float: right;
position: absolute;
right: 1rem;
top: 1rem;
font-weight: 700;
cursor: pointer;
padding-right: 24rem;
opacity: 0.8;
}
span#openPostModal .cardContent {
background: none;
border: none;
position: relative;
width: 90%;
margin: auto;
}
span#openPostModal .cardContent .cardBody {
padding: 0;
}
span#openPostModal .cardContent .cardBody #card-content {
height: 100%;
padding: 0;
}
#card-content.card-content-staticimage .image {
position: relative;
display: inline-block;
width: 100%;
height: 100%;
}
#card-content.card-content-staticimage .image img {
max-height: 100%;
max-width: 100%;
}
You can see the result of that here on my jsFiddle
Any help would be greatly appeciated.
Apparently the whole display: table; and display: table-cell were messing it up. Just changing those to display as block worked. Sorry for the question.
Your problem isn't box-sizing:border-box, it's display:table.
Just add table-layout:fixed; right after the display:table declaration and you should be ok.
Look at the following JSFiddle
.container {
width: 100%;
background-color: yellow;
}
.classic {
display: block;
position: relative;
margin-left: auto;
margin-right: auto;
background-position: center center;
background-image: url("http://www.pulsarwallpapers.com/data/media/3/Alien%20Ink%202560X1600%20Abstract%20Background.jpg");
background-size: contain;
background-repeat: no-repeat;
}
.classic-img {
display: block;
position: absolute;
overflow: hidden;
width: 100%;
height: 100%;
top: 0%;
left: 0%;
}
.classic-img img {
position: absolute;
width: 100%;
height: 100%;
top: 0;
left: 0;
}
.top-menu {
width: 100%;
height: 50px;
position: relative;
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 {
width: 100%;
height: 50px;
position: relative;
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;
}
<div class="list">
<a class="item">
<div id="container" class="container">
<div class="top-menu">
<div class="top-menu-buttons">
<button>-</button>
<span>20</span>
<button>+</button>
</div>
</div>
<div id="classic" class="classic">
<div id="classic-img" class="classic-img">
<img src="http://bc03.rp-online.de/polopoly_fs/1.4643662.1415087612!httpImage/2100575733.JPG_gen/derivatives/d540x303/2100575733.JPG" />
</div>
</div>
<div class="bottom-menu">
<div class="bottom-menu-buttons">
<button class="button button-icon ion-eye">1</button>
<button class="button button-icon ion-refresh">2</button>
<button class="button button-icon ion-crop">3</button>
<button class="button button-icon ion-android-options">4</button>
<button class="button button-icon ion-social-tumblr">5</button>
</div>
</div>
</a>
</div>
CSS:
What i want to achieve is something like the following:
The red area should be a top menu. It should not be a fixed top position it should just always be on top of the image.
As you can see the image has a white background and a black forground. It should look like a polaroid.
The green area should be a menu at the bottom but also not fixed to the bottom it should just always be underneath the image. If there is not enough space it should simply scroll not clinch or esize any of the divs. I guess the main problem is the div in the middle where the image with the background image is.
I try for ages now to get the correct css but unfortunately im very unexperienced and all i can do at the moment is try and error but i cant get it working.
remove position: absolute from .classic-img and .classic-img img
add margin: 100px auto; adjust 100px as per your need, also you have set background-size: contain and the aspect ratio of bg image is almost equal to the image, therefore you would see only small portion of bg image here in the fiddle - jsfiddle.net/18vg13dt/3
additionally if you want gap from left and right also the use - margin: 100px 50px; similarly according to your needs.
jsfiddle
I guess this is what you want?
.classic {
background: url("http://www.pulsarwallpapers.com/data/media/3/Alien%20Ink%202560X1600%20Abstract%20Background.jpg")no-repeat center center;
background-repeat: no-repeat;
background-size: cover;
}
.classic-img {
padding: 10px;
box-sizing: border-box;
}
.classic-img img {
display:block;
width:100%;
height:100%;
}
You need to set the height for the class .classic-img
Try this :
.classic-img {
display: block;
position: relative; /*---absolute to relative*/
overflow: hidden;
width: 100%;
height: 100px; /*----Adjust the height---*/
top: 0%;
left: 0%;
}
If you still face the issue, do come back and let us know.
i have a Div that contain a img and a text
i want to use that Div like a button
here is my html code:
<div id="p6btnBack" class="btn">
<img id="p6btnCircleBack" src="img/back.png" class="btnCircle" />
Back
</div>
and css code is :
.btn {
position: fixed;
width: 10%;
top: 24%;
left: 2%;
height: 7%;
font-size: 25pt;
background-size: cover;
}
.btnCircle {
position: relative;
top: 0%;
left: 0%;
height:100%;
background-repeat: no-repeat;
background-size: contain;
}
i want to put "Back" text in middle vertical of div ...anybody know how i do taht ?
thx
css
write text-align:center; in .btn class
btn {
position: fixed;
width: 10%;
top: 24%;
left: 2%;
height: 7%;
font-size: 25pt;
background-size: cover;
text-align:center;
}
working fiddle
demo1
css
body {
width: 100%;
height: 100%;
}
div {
position:absolute; height:100%; width:100%;
display: table;
}
h1 {
display: table-cell;
vertical-align: middle;
text-align:center;
}
html
<body>
<div>
<h1>Text</h1>
</div>
</body>
fiddle
the answer is :
CSS:
.btn{
position: fixed;
font-size: 25pt;
width: 11%;
top: 83%;
left: 48%;
height: 6%;
padding-top: 10px;
padding-left: 5%;
}
.btnCircle {
position: absolute;
top: 0%;
left: 3%;
height: 100%;
background-repeat: no-repeat;
}
HTML:
<div id="p6btnBack" class="btn">
<img id="p6btnCircleBack" src="img/back.png" class="btnCircle" />
Back
</div>
I'm trying to accomplish something like this:
Specifically the vertical text outlined in white.
I am able to do this and make it dynamic (so there is no overlap between each of the words "fale" "que" "nem" "um" "gringo"), but it requires that I created a containing div for each of the headers, like so,
<div id="fale_textbox_0">
<div class="highlight0a" id="Fale">
<h1 class="fale_heading">Fale</h1>
</div>
<div class="highlight0a" id="que">
<h1 class="fale_heading">que</h1>
</div>
<div class="highlight0a" id="nem">
<h1 class="fale_heading">nem</h1>
</div>
<div class="highlight0a" id="um">
<h1 class="fale_heading">um</h1>
</div>
</div>
I know that it's because is a block-type element. Why, then does it not work if I do
<div id="fale_text_container">
<h1 class="fale_heading" id="fale">Fale</h1>
<h1 class="fale_heading" id="que">que</h1>
<h1 class="fale_heading" id="nem">nem</h1>
<h1 class="fale_heading" id="um">um</h1>
<div id="fale_textbox_2">
<h1 class id="fale_heading_2">Rápido</h1>
</div>
<div id="fale_textbox_3">
<h2 id="fale_subheading_2">Sem Sotaque</h2>
</div>
<div id="fale_textbox_1">
<h2 id="fale_subheading_1">GRINGO</h2>
</div>
Then set the container to display: block with min-width and max-width established. Like so:
#fale_container {
width: 100%;
float: left;
margin-left: 0;
margin-right: 0;
background-color: black;
height: auto;
min-height: 300px;
position: relative; }
#fale_container_padding {
position: relative;
height: 20%; }
#fale_text_container {
position: relative; }
.fale_heading {
display: block;
position: absolute;
width: 13.32756%;
float: left;
margin-right: 0.00666%;
margin-left: 13.33422%;
color: black;
font-size: 3.5em;
clear: right; }
#fale, #que, #nem, #um {
z-index: 10; }
#fale {
margin-top: -18%; }
#fale:after {
content: '';
z-index: -1;
position: absolute;
background-color: #fff;
width: 87%;
height: 100%;
left: 8%; }
#que {
margin-top: -9.5%; }
#que:after {
content: '';
z-index: -1;
position: absolute;
background-color: #fff;
height: 100%;
width: 73%;
left: 8%; }
#nem {
margin-top: -1%; }
#nem:after {
content: '';
z-index: -1;
position: absolute;
background-color: #fff;
height: 100%;
width: 82%;
left: 8%; }
#um {
margin-top: 7%; }
#um:after {
content: '';
z-index: -1;
position: absolute;
background-color: #fff;
height: 100%;
width: 89%;
left: 8%; }
When I do it like this there's overlap. JSfiddle
Block alone doesn't work. Neither does block and min-width and min-height. Neither does min-width and min-height without block. Is it because the container is set to position:relative inside of a <div> that's height is set to auto?
Why don't Block nor min properties work properly?
Here's an edited fiddle: http://jsfiddle.net/0ya6zfLf/1/
HTML
You need to wrap all the floating elements into a container and give position: absolute; to that. (Instead of to individual headings) This way each of your headings can be positioned relatively and maintain their heights perfectly.
<div class="white-strips-container">
<h1 class="fale_heading" id="fale">Fale</h1>
<h1 class="fale_heading" id="que">que</h1>
<h1 class="fale_heading" id="nem">nem</h1>
<h1 class="fale_heading" id="um">um</h1>
</div>
CSS
For the new wrapper class
.white-strips-container {
position: absolute;
width: 150px;
}
For the headings
.fale_heading {
display: inline-block;
line-height: 20px;
margin-right: 0.00666%;
margin-left: 13.33422%;
color: black;
font-size: 3.5em;
height: 50px;
clear: right;
background-color: #fff;
margin-top: 0;
margin-bottom: 10px;
}