I can't seem to get the background image to show in Safari. It works in IE and Chrome. I tried a couple of alternates with the -webkit prefix but no dice.
<style type="text/css">
h1, h2, h3, h4, p {position: relative; z-index: 10;}
.jumbotron {
position: relative;
z-index: 3;
}
.jumbotron:after {
background: linear-gradient(rgba(255,255,255,1), rgba(255,255,255,.5)), url('img/carousel_island.png');
bottom: 0;
content: "";
display: block;
left: 0;
position: absolute;
right: 0;
top: 0;
z-index: 2;
}
</style>
Here is the HTML:
<!-- Main jumbotron for a primary marketing message or call to action -->
<div class="jumbotron">
<div class="container">
<h1><strong>Welcome to Pepi's Island</strong></h1>
<h3><strong>A place for kids to emotionally and socially learn and grow.</strong></h3>
<br>
<p><a class="btn btn-success btn-lg">Learn more ยป</a></p>
</div>
</div>
Safari has some known bugs when using the short-hand background style; some features that are supported as individual CSS styles do not work when used together in a single background style.
I'm not sure whether the styles you're using here would be affected, but it's worth a try (I know for a fact that it bites background-sizing and others).
So I suggest splitting your background style out into separate styles:
background-color: linear-gradient(rgba(255,255,255,1), rgba(255,255,255,.5));
background-image: url('img/carousel_island.png');
Hope that helps.
Try
.jumbotron:after {
content: url(img/carousel_island.png);
background-color:linear-gradient(rgba(255,255,255,1), rgba(255,255,255,.5));
bottom: 0;
content: "";
display: block;
left: 0;
position: absolute;
right: 0;
top: 0;
z-index: 2;
}
For my simple test it DOES show up, but your background is from white to 0.5 alpha-white. Try adding "background-color: red" to the CSS and you'll see your problem.
EDIT:
Some seconds after posting it I realized how stupid it was before actually testing it on safari, my bad.
I can confirm that it does not work in safari 5.xx on win7. But this worked for me, could you test if it does for you also?
.jumbotron:after {
background-image:url('img/carousel_island.png');
}
If not, there are some more ideas that come to my mind (just long-shot-guesses):
1. mobile safaris have a limitation of 3MP or 5MP for PNG images
2. case of letters
3. try `./img/carousel_island.png`
4. A protocol restriction? Do you run it on a server or by `file://` or a `http(s)://` protocol?
Related
How do you make the position: absolute; position: relative; stay together but have an auto height
I am trying to make profile cards in the style of Discord (latest design). When trying to show both the banner and a banner color it isn't aligned correctly. If anyone could help me, please?
Screenshot 1
Screenshot 2
To debug I tried to use CSS data selectors (\[data-??='true'\])
.preview-card.pfp[data-prem='True'] img {
top: 85px;
}
.preview-card .pfp[data-prem='False'] img {
top: 50px;
}
Yesm this will work but not for everything.
I think you have a space missing. Try this maybe:
.preview-card .pfp[data-prem='True'] img {
top: 85px;
}
.preview-card .pfp[data-prem='False'] img {
top: 50px;
}
So, I'm moving from Wix to Neocities. And I can't really just take the pages from Wix and paste them into Neocities, so I need to remake a few things by hand now.
I already asked google about this and got this as an answer:
How do I position one image on top of another in HTML?
Which, for only TWO images works, sort of fine, aside from the fact that it literally just breaks if I add align="center" to the div.
It also just... doesn't really allow me to put more than the first two on top?
Here's the full code in the page:
<title>Work in progress...</title>
<link rel="icon" type="image/x-icon" href="/pages/images/favicons/main.png">
<link rel="stylesheet" type="text/css" href="/style.css">
<!-- CSS and div to make the site logo look the same as the Wix version, modified from https://stackoverflow.com/questions/48474/how-do-i-position-one-image-on-top-of-another-in-html
I might just put this into the main style.css, not sure.-->
<style>
.logo {
position: relative;
top: 0;
left: 0;
}
.image1 {
position: relative;
top: 0;
left: 0;
}
.image2 {
position: relative;
top: 0;
left: 0;
}
.image3 {
position: absolute;
top: 0px;
left: 0px;
}
</style>
<div class="logo">
<img class="image1" src="/pages/images/general/logo/1.gif" />
<img class="image2" src="/pages/images/general/logo/2.gif" />
<img class="image3" src="/pages/images/general/logo/3.gif" />
</div>
Since this stupid dumb site needs me to have 10 rep to even post images, you'll just have to take these links instead. At least I don't have to break the links like on GBATemp back when I was new there. I get that it's to prevent spam, but isn't there a better way?
Expected result:
https://i.stack.imgur.com/suFVh.png
Actual result:
https://i.stack.imgur.com/suXC7.png
(screenshot left slightly uncropped to show that it's starting at the top-left of the page, not the absolute-regardless-of-window-size center like I want. plus the 3rd image (filename 3.gif) is completely outside of the div!)
I feel like a valve developer working on TF2. This shit doesn't work!! Why? Has I ever?
In all seriousness, I'm still new to CSS and just want to know what the hell is wrong because doing it the HTML way would be WAY WAY easier for me than the "just put them all into one gif" way.
What I want in the end is for the div to just control the position of all 3 images inside of it, so that I can just put align="center" into the div's opening tag and have it just work.
Oh, and I'll put a live preview of the site at https://catboybeebop.neocities.org/pages/main_new.html, so you guys can see this all in action to better help me through this.
.logo {
position: relative;
top: 0;
left: 0;
}
.image1 {
position: absoulute;
top: 0;
left: 0;
}
.image2 {
position: absolute;
top: 0;
left: 0;
}
.image3 {
position: absolute;
top: 0;
left: 0;
}
<div class="logo">
<img class="image1" src="https://catboybeebop.neocities.org/pages/images/general/logo/1.gif" />
<img class="image2" src="https://catboybeebop.neocities.org/pages/images/general/logo/2.gif" />
<img class="image3" src="https://catboybeebop.neocities.org/pages/images/general/logo/3.gif" />
</div>
So, I made a sister thread about this on gbatemp and actually got a working answer pretty quickly!
To quote shaunj66:
Get rid of the center property on each CSS declaration. It's not valid.
Remove position from image1 so it gives the parent logo div a calculated height so that any following content added later will be below the logo div.
Add left and right rules to image2 and image3 so the browser knows there to position them then add margin 0 auto (0 margins top and bottom, automatic margins left and right) to centrally position them.
CSS:
.logo {
position: relative;
}
.image2, .image3 {
position: absolute;
left: 0;
right: 0;
margin: 0 auto;
}
As far as I know I can't directly change the opacity of a background image but using ::before and ::after doesn't seem to let my image show up. Am I doing it wrong?
HTML
flower window boxes
All of our products come in virtually any length up to 16 feet and two sizes. Our standard size boxes are designed to accommodate almost any flower. Our XL sizes are taller and deeper to provide more root space for plants making them the ideal sized window boxes for plants.
</div>
<div class="card-back">
<h2 class="click-here"><b>Visit Site</b></h2>
<div class="info">
<h2 class="info">Email:</h2>
<h2 class="info">Phone:</h2>
</div>
</div>
<!-- Content -->
<div class="all-content">
<h1>Contrary to popular belief</h1>
</div>
</li>
Current CSS
.content li:nth-child(1) .card-back{
background-image:url(../images/sponsor-imgs/Cellular%20PVC%20Columns-Kingston-1.jpg);
width: 100%;}
What I've tried
.backimg::after {
background-image:url(../images/backimg/wide.png);
opacity: 0.5;
}
.backimg::before{
background-image:url(../images/backimg/wide.png);
opacity: 0.5;
}
div::after {
opacity: 0.5;
}
On a side not i know i can simply make the images themselves transparent, but i feel like a code to do it much more useful in the long run. thanks in advance.
::before and ::after require a content property. You can set it to an empty string but it must be included.
In most cases you also need to define a display property and assign some dimensions to the element (unless you are using something like position: absolute; top: 0; bottom: 0; left: 0; right: 0; - in which case, you don't).
.backimg {
background: red;
}
.backimg::after {
content: "";
display: block;
width: 200px;
height: 200px;
background-image: url(http://placehold.it/200x200);
opacity: 0.5;
}
<div class="backimg"></div>
You are missing the .backimg class in your html.
Dont use double :: and add content and display properties to after. Also some dimensions wouldnt hourt (width,height)
.class:after{
Cintent:"";
Display:block; // change as you see fit
}
I'm new to HTML5 and I'd like some help adapting this particular code: http://thecodeplayer.com/walkthrough/html5-canvas-snow-effect to be used as a background for a webpage. I've got the snow falling but when I use it as a background, nothing else displays.
You can use z-index with a value of -1 on it:
#myCanvas {
position: fixed; /* or absolute */
z-index: -1; /* put it behind all other elements */
}
Made a JSFiddle to have something to work with. As others stated, position: fixed; and z-index: -1; for the canvas works fine.
This worked for me...
CSS
#myCanvas
{
display: block;
position: absolute;
z-index: -1; //optional.. Depends if you have used z-index for any other element
}
Hope it helps someone...!!
This works for me as well. For future reference to manipulate the z-index you are required to also set the position to absolute or it will not work.
#canvas {
background: #202020;
position: absolute;
z-index: -1;
}
I have been working on a project in GWT for which i need to show a loading image as like "Please Wait...".
I was able to fix this till page loads. But during history token changes, i cant show the same. I created a division as shown below,
<div id="loader">
<div id="loaderPanel">
</div>
<div id="loaderImage">
<div id="loaderText">
<b>Please Wait...</b>
</div>
<img src="images/loader.gif"/>
</div>
</div>
Also, here is my CSS
#loaderPanel {
background-color: white;
display: block;
height: 100%;
left: 0;
opacity: 0.8;
position: fixed;
top: 0;
width: 100%;
z-index: 1001;
}
#loaderImage {
background-color: transparent;
left: 48%;
position: fixed;
top: 48%;
z-index: 1002;
}
#loaderImage img{
height:22px;
margin-left:4px;
margin-top:0px;
width:119px;
}
#loaderText{
font-family:'Verdana';
font-weight:bold;
font-size:0.9em;
float:left;
}
This is the piece of code i used to make the DIV visible & invisible.
DOM.getElementById("loader").getStyle().setDisplay(Display.NONE);
DOM.getElementById("loader").getStyle().setDisplay(Display.BLOCK);
Can anyone please suggest me a better way to show a loading GIF image for History Changes?
YOu should implement HistoryListener and show the gif when the onModuleLoad() method is called:
http://google-web-toolkit.googlecode.com/svn/javadoc/1.5/com/google/gwt/user/client/History.html
I got the Answer,
It was not showing the Loading Image because the execution locally was much faster. But when it comes to production mode, i found that, it is showing a loading image for a while.
Since my client strictly needs to show the loader, he suggested me to add a small delay. So i added the delay inside a Timer Scheduled. By the time it shows the loader, i did the Pre-Fetching of the Images and other objects used in the page.
So i mark my question as Closed...