How to add a label to images on website using ATTR? - html

I'd like to attach a label to the images on my website, so I used the following CSS and HTML code.
CSS:
/* Image */
.image {
border: 0;
display: inline-block;
position: relative; }
.image::after {
content: "Photo credit: Me";
position: absolute;
bottom: 0;
right: 3em;
font-size: 0.7em;
color:rgba(0, 0, 0, 0.175)}
.image img {
display: block; }
.image.left, .image.right {
max-width: 30%; }
HTML:
<div class="row">
<p>
<span class="image left">
<img src="images/image_1.png">
</span>
</p>
</div>
The code above works perfectly but I don't always want to show "Photo credit: Me" on my images. Instead, I want to set "Photo credit: Me" as a default text but show different text when specified. I tried using attr like below:
/* Image */
.image {
border: 0;
display: inline-block;
position: relative; }
.image::after {
content: attr(data-content, "Photo credit: Me"); /*<--Modified */
position: absolute;
bottom: 0;
right: 3em;
font-size: 0.7em;
color:rgba(0, 0, 0, 0.175)}
.image img {
display: block; }
.image.left, .image.right {
max-width: 30%; }
<div class="row">
<p>
<span class="image left">
<img src="images/image_1.png" data-content="Photo credit: Others">
</span>
</p>
</div>
However, this code does not show anything on the images. What am I doing wrong?
Note: I'm using a template downloaded from https://html5up.net/editorial . There is a chance that some properties defined elsewhere in CSS are causing this issue...

first, you shoud put the data-content on span, because the class .image is on span.
second, till 2022-12-17, browser only supports basic attr() method, no one support fallback feature. if you want to implmenet fallback feature, you can use var to work around.
please check the code below:
css
/* Image */
.image {
border: 0;
display: inline-block;
position: relative;
}
.image[data-content] {
--test : attr(data-content); /* if image have data-content, then we defined the variable test) */
}
.image::after {
content: var(--test, "Photo credit: Me"); /*if var test not be define, we use default value */
position: absolute;
bottom: 0;
right: 3em;
font-size: 0.7em;
color:rgba(0, 0, 0, 0.175)}
.image img {
display: block; }
.image.left, .image.right {
max-width: 30%; }
html
<div class="row">
<p>
<span class="image left" data-content="Photo credit: Others">
<img src="images/image_1.png">
</span>
</p>
</div>

Related

How to open a menu in electron js on click of a div

I made a custom title bar application and then I gave it a file menu also.(electron)
Now I want to open a menu on click of this menu. I want a popup but the popup shouldn't be the standard windows popup for the menus , I want to make that custom too...but crating a new window can become very tedious if it takes too much time.
Most probably I want to instantiate a section , but I have no idea how to do it
The current situation
I have a window with a #container div having a #buttons div having 3 #minimize,#maximize,#close each with a span
The #buttons also has 2 divs .menu1 and .menu2 i want these menus to behave like normal menus in windows like the file and edit menu
<div id="container">
<nav>
<div id="buttons">
<div id="file">
<span class = "menu1">file</span>
</div>
<div id="about_us">
<span class = "menu2">about..us</span>
</div>
<div id="minimize" onclick="min()">
<span>-</span>
</div>
<div id="maximize" onclick="max()">
<span>+</span>
</div>
<div id="close" onclick="uff()">
<span>×</span>
</div>
</div>
</nav>
</div>
The result is
All the menus and buttons are clickable and have hover colors
Here you need to do something like this:
create the popup window in html and css. Use position: absolute; and z-index to get it to overlay the rest of the application.
Then hide the popup with a css class of for example .hidethat sets the popup to display: none;.
You now need a small piece of javascript to toggle that .hide class. Something like for example a function like this: const togglePopup = () => document.querySelector('.popup').classList.toggle('hide')
Trigger the togglePopup script with the click on one of your elements:
const trigger = document.querySelector('#idOrClassOfTriggerElement')
trigger.addEventListener('click', () => togglePopup()
Add a method for closing the popup with the same type of technique – adding an eventlistener to a trigger element (X icon for example) and calling the same toggle function as in #3.
Hope this was somehow what you wanted to achieve.
EDIT: Example code for a popup overlay:
const popup = document.querySelector('.popup')
const closeBtn = document.querySelector('.popup-close')
const openBtn = document.querySelector('.open')
const body = document.querySelector('body')
const showPopup = () => {
popup.classList.add('fade-in')
body.classList.add('scroll-stop')
}
const hidePopup = () => {
popup.classList.remove('fade-in')
popup.classList.add('fade-out')
body.classList.remove('scroll-stop')
setTimeout(() => {
popup.classList.remove('fade-out')
}, 500)
body.focus();
}
openBtn.addEventListener('click', showPopup)
closeBtn.addEventListener('click', hidePopup)
.popup {
position: fixed;
width: 100%;
height: 100%;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: #fefefe;
z-index: 9;
opacity: 0;
pointer-events: none;
overflow: scroll;
}
.popup-inner {
width: 100%;
position: relative;
padding: 6% 16% 0;
}
.popup-close {
position: relative;
z-index: 10;
text-align: center;
color: #aaa;
font-size: 4rem;
cursor: pointer;
position: fixed;
right: 3%;
top: 3%;
}
.popup-close::before {
content: "\00d7";
}
.popup-close:hover::before {
color: #000;
transition: 0.6s all ease-in;
}
.open {
text-align: center;
cursor: pointer;
background: transparent;
padding: 1rem 2rem;
border: 2px solid;
border-radius: 6px;
color: #000;
font-weight: bold;
position: absolute;
top: 25%;
left: 44%;
}
.open:hover {
background: #ffffff18;
}
.fade-in {
opacity: 1;
pointer-events: unset;
transition: 0.3s all ease;
}
.fade-out {
opacity: 0;
pointer-events: none;
transition: 0.3s all ease;
}
.background {
height: 100vh;
width: 100vw;
background: olive;
margin: 0;
padding: 0;
}
<div class="background">
<button class="open">OPEN POPUP</a>
</div>
<!-- Add popup at the bottom of the html document, before </body> -->
<div class="popup" role="dialog" aria-label="Popup">
<div class="popup-close" role="button" arial-label="Close popup" tabindex="1"></div>
<div class="popup-inner">
<h2>This is a popup title</h3>
<p>Popup content...</p>
</div>
</div>

SVG image within an absolutely positioned div is different on Firefox than Chrome

I have the following web page:
http://designsystem.foamfactory.io/current/components/preview/main.html
It's basically a set of text, along with a couple of SVG images. In order to get the effect that I want (the hex bolts should be overlaid in a specific position on the text), I use absolute positioning within a relatively positioned container.
The actual HTML code and CSS are fairly simple, and outlined in this codepen:
https://codepen.io/jwir3/pen/ZEzRKyz
The associated HTML is:
<div class="lockup">
<img class="lockup-logo logo-medium" src="http://designsystem.foamfactory.io/current/dist/assets/logos/Logo.svg" />
<div class="textmark textmark-medium">
<div id="hex-bolt-f-top">
<img src="http://designsystem.foamfactory.io/current/dist/assets/misc/Hex%20Bolt.svg" />
</div>
<div id="hex-bolt-f-bottom">
<img src="http://designsystem.foamfactory.io/current/dist/assets/misc/Hex%20Bolt.svg" />
</div>
<div id="hex-bolt-y-middle">
<img src="http://designsystem.foamfactory.io/current/dist/assets/misc/Hex%20Bolt.svg" />
</div>
<div id="hex-bolt-y-bottom">
<img src="http://designsystem.foamfactory.io/current/dist/assets/misc/Hex%20Bolt.svg" />
</div>
<div class="textmark-text">Foamfactor<span class="last-letter">y</span></div>
</div>
<div class="empty"></div>
</div>
and CSS:
.lockup {
display: -ms-flexbox;
display: flex;
-ms-flex-align: center;
align-items: center;
-ms-flex-pack: start;
justify-content: flex-start;
}
.lockup .empty {
-ms-flex-positive: 4;
flex-grow: 4;
}
.lockup-logo {
display: inline;
}
.textmark {
display: inline-block;
box-sizing: border-box;
position: relative;
padding: 0;
-ms-flex: 1 1 0px;
flex: 1 1 0;
margin-left: .2em;
}
.textmark .textmark-text {
display: block;
color: black !important;
box-sizing: border-box;
font-family: "Staatliches";
line-height: 1.0;
letter-spacing: -.04em;
}
.textmark.textmark-large {
font-size: 200pt;
}
.textmark.textmark-large .textmark-text::first-letter,
.textmark.textmark-large .textmark-text .last-letter {
font-size: 300pt;
}
.textmark.textmark-large .textmark-text .last-letter {
margin-left: -.04em;
}
.textmark.textmark-medium {
font-size: 80pt;
}
.textmark.textmark-medium .textmark-text::first-letter,
.textmark.textmark-medium .textmark-text .last-letter {
font-size: 120pt;
}
.textmark.textmark-medium .textmark-text .last-letter {
margin-left: -.04em;
}
.textmark.textmark-small {
font-size: 40pt;
}
.textmark.textmark-small .textmark-text::first-letter,
.textmark.textmark-small .textmark-text .last-letter {
font-size: 60pt;
}
.textmark.textmark-small .textmark-text .last-letter {
margin-left: -.04em;
}
.textmark.textmark-tiny {
font-size: 24pt;
}
.textmark.textmark-tiny .textmark-text::first-letter,
.textmark.textmark-tiny .textmark-text .last-letter {
font-size: 36pt;
}
.textmark.textmark-tiny .textmark-text .last-letter {
margin-left: -.04em;
}
.textmark #hex-bolt-f-top img,
.textmark #hex-bolt-f-bottom img,
.textmark #hex-bolt-y-bottom img,
.textmark #hex-bolt-y-middle img {
width: .08em;
}
.textmark #hex-bolt-f-top {
position: absolute;
top: -.6em;
left: .1em;
}
.textmark #hex-bolt-f-bottom {
position: absolute;
bottom: .1em;
left: .1em;
}
.textmark #hex-bolt-y-bottom {
position: absolute;
bottom: .1em;
right: .2282em;
}
.textmark #hex-bolt-y-middle {
position: absolute;
top: -.1em;
right: .2282em;
}
In Chrome, this always looks how I would expect. In Firefox (I'm using Nightly, but I have tried it on the latest release as well), however, the hex bolts on the far right of the div (the "Y") are too far to the right. Even stranger, most of the time it looks fine in Firefox, too, but when I inspect it using dev tools, it changes the width of the box or something, and it gets screwed up until I shift-refresh (a simple refresh won't fix the issue).
I'm fairly certain that the problem lies with the fact that the outermost div for this entire text/logo combination is a flexible box. The reason I have it that way is to center it on the page. Perhaps there is another way to achieve the results I want without this?
More to the point, I'm unclear on why the behavior is different between the two browsers. Have I hit on an area where the specification isn't well defined?
this solves the issue but you need to correct the first letter
.textmark .textmark-text {
display: inline;
}
I think the easiest way would be to center it with this:
.centered {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
That way you only have something like:
<body class="frontmatter index">
<div class="centered">
<div>
<div class="lockup">
<img class="lockup-logo logo-medium" src="../../dist/assets/logos/Logo.svg">
<div class="textmark textmark-medium">
<div id="hex-bolt-f-top">
<img src="../../dist/assets/misc/Hex Bolt.svg">
</div>
<div id="hex-bolt-f-bottom">
<img src="../../dist/assets/misc/Hex Bolt.svg">
</div>
<div id="hex-bolt-y-middle">
<img src="../../dist/assets/misc/Hex Bolt.svg">
</div>
<div id="hex-bolt-y-bottom">
<img src="../../dist/assets/misc/Hex Bolt.svg">
</div>
<div class="textmark-text">Foamfactor<span class="last-letter">y</span></div>
</div>
<div class="empty"></div>
</div>
</div>
<h2>An elegant brewery management system for a more civilized age</h2>
</div>
....
</body>
Flexbox might be a little overkill for this in my opinion.
I think you need check this website:
https://validator.w3.org
and scan your website there that web will tell you where to fix your web struct as I check there is many attribute and tag are missing from your web. you may think this is not the problem that cause your website struct error. So please go to that website and fix what is the error left in your web structure.

Basic vertical center in CSS behaving strangely on floated element

So i've come to live by these 3 CSS rules that almost always vertically center any block level element:
.vertically-center {
position: relative;
top: 50%;
transform: translateY( -50% );
}
It works often. But in the case of this particular layout I'm building it is pushing the elements too high ( partially off the screen ) and I don't know why.
This is how the webpage looks before adding my vertically-center class to my portrait-container div:
And this code snippet is how it appears after adding the vertically-center class to the portrait-container div:
.clearfix:after {
content: "";
display: block;
clear: both;
}
.vertically-center {
position: relative;
top: 50%;
transform: translateY( -50% );
}
body {
overflow: hidden;
}
main {
padding-top: 50px;
background: #fafafa;
text-align: left;
}
.portrait-container {
float: left;
}
img {
width: 150px;
border-radius: 50%;
}
.about-container {
width: 70%;
float: right;
}
<main class="clearfix">
<div class="portrait-container vertically-center">
<img src="http://i.imgur.com/Eb5sRZr.jpg" alt="Portrait of John Lesko">
</div>
<div class="about-container">
<h3>About</h3>
<p>
Hi, I'm John Lesko! This is my art portfolio where I share all
of my favorite work. When I'm not creating things, I enjoy excercising,
playing video games, drinking good Kool Aid, and more.
<br><br> If you'd like to follow me on Twitter, my username is
#jletsgo.
</p>
</div>
</main>
I just want the image container to be vertically-centered regardless of the height of it's parent. Help? Inspecting elements gave me no insights.
Edit: Just to show how this has always worked for me in the past. Here is a jsfiddle: https://jsfiddle.net/9kyjt8ze/4/. Why does it work for me there and not here?
Related question: What does top: 50%; actually do on relatively positioned elements?
Your CSS was not bad but I didn't get along with it. So here is another approach on how you could solve it, maybe it helps also. It will always center the image vertically and does not matter how much text the box on the right will have. The colored borders are just there to help show the visual effect of the box sizes.
* {
box-sizing: border-box;
}
.portrait-container {
position: relative;
margin: 20px 0;
}
.portrait-container:after {
content: '';
display: block;
clear: both;
}
.portrait-container img {
position: absolute;
top: calc(50% - 80px); /* 50% from top minus half img height*/
width: 150px;
height: 160px;
border-radius: 50%;
float: left;
}
.portrait-container {
border: solid 2px orange;
}
.portrait-container .about-container {
border: solid 2px green;
padding: 0 50px;
margin-left: 150px; /* this elements should be at least 150px away from left side */
width: calc(100% - 150px); /* the max width this element should have to be placed */
/* next to the image is the total width(100%) - the image width */
}
<main>
<div class="portrait-container">
<img src="http://i.imgur.com/Eb5sRZr.jpg" alt="Portrait of John Lesko">
<div class="about-container">
<h3>About</h3>
<p>
Hi, I'm John Lesko! This is my art portfolio where I share all
of my favorite work. When I'm not creating things, I enjoy excercising,
playing video games, drinking good fruit punch, and more.
<br><br> If you'd like to follow me on Twitter, my username is
#jletsgo.
</p>
</div>
</div>
</main>
<main>
<div class="portrait-container">
<img src="http://i.imgur.com/Eb5sRZr.jpg" alt="Portrait of John Lesko">
<div class="about-container">
<h3>About</h3>
<p>
Hi, I'm John Lesko! This is my art portfolio where I share all
of my favorite work. When I'm not creating things, I enjoy excercising,
playing video games, drinking good fruit punch, and more.
<br><br> If you'd like to follow me on Twitter, my username is
#jletsgo.
</p>
<p>
Hi, I'm John Lesko! This is my art portfolio where I share all
of my favorite work. When I'm not creating things, I enjoy excercising,
playing video games, drinking good fruit punch, and more.
<br><br> If you'd like to follow me on Twitter, my username is
#jletsgo.
</p>
</div>
</div>
</main>
UPDATE
Edit: Just to show how this has always worked for me in the past. Here is a jsfiddle: https://jsfiddle.net/9kyjt8ze/4/. Why does it work for me there and not here?
The black circle is the only element there in the Fiddle, there's no obstructions. In the code you are having trouble with, you have many elements either in the way or wrapped around other elements trapping them. Your ruleset will work if you start stripping away the layers. Or you can just add a property and change another property as per Snippet 1.
One important note a relative element is actually occupying the original spot, so if given a left:40px it appears to be moved 40px to the left, but in reality it still occupies the space 40px to the right of where it appears to be. So relative elements are not really in a flow different from static elements. Therefore they are affected by and affect static layout, it's just not noticeable normally because they stack with z-index.
Snippet 2 is an interactive demo, I figured maybe that'll help explain things better.
The 3 CSS ruleset is a common way to vertically align elements, but it was originally position: absolute instead of position:relative and it had to be in another positioned element if I remember correctly.
REFERENCE
Specific Ruleset
W3Schools
MDN
SOLUTION
.vertically-center {
/* Changed to absolute from relative */
position: absolute;
top: 50%;
transform: translateY( -50% );
}
main {
/* Added position: relative */
position: relative;
padding-top: 50px;
background: #fafafa;
text-align: left;
}
SNIPPET 1
.vertically-center {
position: relative;
top: 50%;
transform: translateY( -50%);
}
body {}
main {
padding-top: 50px;
overflow: scroll;
background: #fafafa;
text-align: left;
}
img {
width: 150px;
border-radius: 50%;
float: left;
}
.about {
width: calc(100% - 150px);
float: right;
}
<main class="clearfix">
<img src="http://i.imgur.com/Eb5sRZr.jpg" alt="Portrait of John Lesko" class="vertically-center">
<article class="vertically-center about">
<h3>About</h3>
<p>
Hi, I'm John Lesko! This is my art portfolio where I share all of my favorite work. When I'm not creating things, I enjoy excercising, playing video games, drinking good Kool Aid, and more.</p>
<p>If you'd like to follow me on Twitter, my username is
#jletsgo.
</p>
</article>
</main>
SNIPPET 2
$('#b1').click(function() {
$('body').toggleClass('R S');
});
$('#b2').click(function() {
$('#N1,#N2,#N3').toggleClass('N M');
});
$('input[id$="2"]').on('input', function() {
var grp = "." + $(this).attr('class');
var num = parseInt($(this).val(), 10);
grp !== '.S' ? $('section' + grp).css('left', num + '%') : $('section.S').css('margin-left', num + '%');
});
$('input[id$="3"]').on('input', function() {
var grp = "." + $(this).attr('class');
var num = parseInt($(this).val(), 10);
grp !== '.S' ? $('section' + grp).css('top', num + '%') : $('section.S').css('margin-top', num + '%');
});
html,
body {
height: 100%;
width: 100%;
}
body {
overflow: scroll;
font: 400 12px/1.2 Consolas;
}
section {
width: 50px;
height: 150px;
border: 2px dashed grey;
text-align: center;
color: white;
}
.R {
position: relative;
background: rgba(0, 0, 255, .3)
}
.A {
position: absolute;
background: rgba(255, 0, 0, .3)
}
.F {
position: fixed;
background: rgba(0, 255, 0, .3)
}
.S {
position: static;
background: rgba(122, 122, 0, .3)
}
.N {
position: absolute;
background: yellow;
color: blue;
}
.M {
position: relative;
background: black;
color: yellow;
}
#R1 {
left: 20%;
top: 3%;
z-index: 1;
}
#A1 {
left: 42%;
top: 44%;
z-index: 2;
}
#F1 {
right: 20%;
top: 44%;
z-index: 3;
}
#S1 {
margin-left: 0;
margin-top: -28%;
}
#N1 {
bottom: 0;
right: 0;
width: 25px;
height: 80px;
z-index: 4;
}
input {
width: 6ex;
position: static !important;
}
button {
font: inherit;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<body class='S'>
<fieldset>
<button id='b1'>Body Relative/Static</button>
<button id='b2'>Nested Absolute/Relative</button>
<br><br> RLeft
<input id='R2' class='R' type='number' value='20'> RTop
<input id='R3' class='R' type='number' value='3'> ALeft
<input id='A2' class='A' type='number' value='44'> ATop
<input id='A3' class='A' type='number' value='44'><br> FLeft
<input id='F2' class='F' type='number' value='64'> FTop
<input id='F3' class='F' type='number' value='44'> SLeft
<input id='S2' class='S' type='number' value='0'> STop
<input id='S3' class='S' type='number' value='-28'><br> NLeft
<input id='N2' class='N' type='number' value='45'> NTop
<input id='N3' class='N' type='number' value='45'>
</fieldset>
<section id='R1' class='R'>RELATIVE
<section id='N1' class='N'>N<br>E<br>S<br>T<br>E<br>D</section>
</section>
<section id='A1' class='A'><br><br><br>ABSOLUTE</section>
<section id='F1' class='F'><br><br>FIXED</section>
<section id='S1' class='S'><br><br><br><br><br>STATIC</section>
</body>
You can achieve this by using flexboxwith a lot less code. The below code will do the trick.
.clearfix {
display: flex;
align-items: center;
}
img {
width: 150px;
border-radius: 50%;
}
.about-container {
width: 70%;
padding-left: 30px;
}
Check it out in codepen http://codepen.io/anon/pen/OWYxrb

Display image on hover, centered in the background

I went through a number of questions regarding displaying image on hover here on Stackoverflow, but couldn't find a solution for my problem.
Right now I managed to display an image in the background of the paragraph once I hover on it. See on JSFiddle.
Ideally what would I like to do achieve: once I hover over an Example1 inside of a paragraph I would like to display Image1 in the background, not below the paragraph, but centered in the background, below all of the elements. As pictured here.
Hovering on Example2 would ideally display Image2, and Example3 would display Image3.
HTML
<div id="imgbg">
<p>Portfolio:</p>
<p>I worked with:<br />
Example1, Example2, Example3, Example4, Example5
</p>
</div>
CSS
#imgbg {
height: 100%;
width: 100%;
}
#imgbg:hover {
background-image: url('http://i.imgur.com/9bbjE1Mb.jpg');
}
Does anyone have a solution? Many thanks.
You can use javascript as that
function showBg() {
document.body.style.backgroundImage = "url('http://i.imgur.com/9bbjE1Mb.jpg')";
}
function hideBg() {
document.body.style.backgroundImage = null;
}
<div onmouseover="showBg()" onmouseleave="hideBg()" id="imgbg">
<p>I worked with:
<br />Example1, Example2, Example3, Example4, Example5
</p>
</div>
you should wrap Example1 and Example2 with span tag or div
and add css rules for these wraps.
<span id="ex1">Example1</span>, <span id="ex2">Example2</span>, Example3, Example4, Example5
and add css
#ex1, #ex2 {
display:inline-block;
height:50px;
}
#ex1:hover {
background-image:url('http://i.imgur.com/9bbjE1Mb.jpg');
}
#ex2:hover {
background-image:url('http://i.imgur.com/9bbjE1Mb.jpg');
}
Look at https://jsfiddle.net/4tubcy8e/6/
I hope this may help you.
#imgbg {
position: relative;
width: 100%;
height: 265px;
}
#imgbg .Example:hover:after {
display: block;
}
#imgbg .Example:after {
content: '';
display: none;
width: 160px;
height: 160px;
background: url('http://i.imgur.com/9bbjE1Mb.jpg');
background-size: contain;
position: absolute;
top: 50%;
left: 0;
margin-top: -80px;
margin-left: 145px;
z-index: -1;
}
<div id="imgbg">
<p>Portfolio:</p>
<p>I worked with:<br />
<span class="Example">Example1</span>,
<span class="Example">Example2</span>,
<span class="Example">Example3</span>,
<span class="Example">Example4</span>,
<span class="Example">Example5</span>
</p>
</div>

Coding with background images

Currently i have a running slideshow as my website background (3 images)
I also have a logo in the middle of these 3 images, which remains there throughout the duration of the slideshow.
Whilst the first image is displayed (when the website is loaded up) the logo image (which also has the function of a button) can be clicked and direct you to another website, however when the images change, the logo remains, however the ability to click is gone...
all help greatly appreciated
here is my current code
$(document).ready(function() {
var header = $('body');
var backgrounds = new Array(
'url(http://urs2009.net/wp-content/uploads/2011/11/lights-of-city.jpg)', 'url(http://hdwallpaperd.com/wp-content/uploads/2014/12/background-wallpaper-hd-1.jpg)', 'url(http://guruwallpapers.com/wp-content/uploads/2014/09/Sunset-Wide-Screen-Wallpapers-6.jpg)'
);
var current = 0;
function nextBackground() {
$('#mask').fadeTo(1000, 0.9, function() {
current++;
current = current % backgrounds.length;
header.css('background-image', backgrounds[current]);
})
$('#mask').fadeTo(500, 0);
}
setInterval(nextBackground, 5000);
header.css('background-image', backgrounds[0]);
});
body {
-webkit-background-size: 1390px 700px;
-moz-background-size: 1390px 700px;
background-size: 1390px 700px;
}
h1 {
font-size: 600%;
color: white;
margin-top: 0.5em;
}
h3 {
color: white;
margin-top: -50px;
}
.GFImage {
margin-top: 65px;
border: 0;
}
.Footer {
position: fixed;
bottom: 0;
width: 100%;
margin-left: -8px;
color: white;
background: #151515;
opacity: 0.8;
text-align: center;
vertical-align: middle;
height: 7%;
}
#mask {
width: 100%;
height: 100%;
background: #000000;
top: 0;
left: 0;
position: absolute;
display: none;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<center>
<br>
<h1>Welcome to GF</h1>
</center>
<center>
<br>
<h3>Welcome to GF! Check out all the information you need by just the click of a button...</h3>
</center>
<center>
<a href="Home Page .html">
<img src="Images/GF Logo White .jpg" style="width: 275px; height: 275px;" class="GFImage">
</a>
</center>
<div class="Footer">
<p>Copyright &COPY All Rights Reserved. Design by Gavin Foley.</p>
</div>
<div id="mask">SCRIPT FUNCTION IN HERE!!!!</div>
Seams like the link goes below the images.
I was able to solve this adding to the link element these properties:
position:absolute;
z-index:9
and then it should work.
EDIT
Just as a suggestion, have a look at this example, it could be useful if you are at the first try with html and css:
http://css-tricks.com/perfect-full-page-background-image/