Using multiple links for a single modal - html

Ok, so I'm attempting to put multiple modal links on a single page, but when each one is clicked, the same modal opens up for all the links because they all use #target-content. I really like this specific modal, but is there a way not have the same modal open up based on the code below? Thank you!
HTML
Open A Modal
<div id="target-content">
<div id="target-inner">
<h2>Modal Heading</h2>
<p>Modal Content</p>
</div>
</div>
CSS
#target-content {
position: fixed;
top: 0;
right: 0;
bottom: 0;
left: 0;
pointer-events: none;
opacity: 0;
-webkit-transition: opacity 200ms;
transition: opacity 200ms;
}
#target-content:target {
pointer-events: all;
opacity: 1;
}
#target-content #target-inner {
position: absolute;
display: block;
padding: 48px;
line-height: 1.8;
width: 70%;
top: 50%;
left: 50%;
-webkit-transform: translateX(-50%) translateY(-50%);
-ms-transform: translateX(-50%) translateY(-50%);
transform: translateX(-50%) translateY(-50%);
box-shadow: 0px 12px 24px rgba(0, 0, 0, 0.2);
background: white;
color: #34495E;
}
#target-content #target-inner h2 { margin-top: 0; }
#target-content #target-inner code { font-weight: bold; }
#target-content a.close {
content: "";
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
background-color: #34495E;
opacity: 0.5;
-webkit-transition: opacity 200ms;
transition: opacity 200ms;
}
#target-content a.close:hover { opacity: 0.4; }

Your only supposed to use the #id-name once.
Change the name of the id's #target-content, #target-content1 etc..,
You can use the same css styling with a .class-name but #id-names are supposed to be unique.

Related

How to rotate arrow icon in left side? Without rotate all icon ? Only css

I need to rotate icon to left side. I have example in right side and this is work good but i need also in left side.
Check this ->
https://codepen.io/HektorW/pen/eJMMaR
This is example code ->
.arrow {
cursor: pointer;
height: 120px;
left: 50%;
position: absolute;
top: 50%;
transform: translateX(-50%) translateY(-50%);
transition: transform 0.1s;
width: 80px;
}
.arrow-top, .arrow-bottom {
background-color: #666;
height: 4px;
left: -5px;
position: absolute;
top: 50%;
width: 100%;
}
.arrow-top:after, .arrow-bottom:after {
background-color: #fff;
content: '';
height: 100%;
position: absolute;
top: 0;
transition: all 0.15s;
}
.arrow-top {
transform: rotate(45deg);
transform-origin: bottom right;
}
.arrow-top:after {
left: 100%;
right: 0;
transition-delay: 0s;
}
.arrow-bottom {
transform: rotate(-45deg);
transform-origin: top right;
}
.arrow-bottom:after {
left: 0;
right: 100%;
transition-delay: 0.15s;
}
.arrow:hover .arrow-top:after {
left: 0;
transition-delay: 0.15s;
}
.arrow:hover .arrow-bottom:after {
right: 0;
transition-delay: 0s;
}
.arrow:active {
transform: translateX(-50%) translateY(-50%) scale(0.9);
}
What i am try ->>>
.arrow {
cursor: pointer;
height: 120px;
left: 50%;
position: absolute;
top: 50%;
transform: translateX(-50%) translateY(-50%) rotate(180deg); ADD ROTATE
transition: transform 0.1s;
width: 80px;
}
I am added rotate(180deg) but this is no work property because on click the whole arrow turns to me.
I need arrow top and botton to change
I am also try to set
transform-origin: top left;
Insted transform-origin: top right;
but also is not accurate arrow corner.
Edit:
Also try to no change animation....
You need to add the rotation in the :active class too:
&:active {
transform: translateX(-50%) translateY(-50%) scale(0.9) rotate(180deg);
}
So the rotation keeps taking effect.
Example: CodePen
You can do some small changes to have an arrow that has the animation in the correct direction.
You need to reverse the transform-origin and the transition-delay switching the two would give you an arrow that has a similar animation with the correct origin and format the arrow in the correct way.
body {
background-color: #111;
}
.arrowleft {
cursor: pointer;
height: 120px;
left: 50%;
position: absolute;
top: 50%;
transform: translateX(-50%) translateY(-50%);
transition: transform .1s;
width: 80px;
$transition-time: .15s;
&-top,
&-bottom {
background-color: #666;
height: 4px;
left: -5px;
position: absolute;
top: 50%;
width: 100%;
&:after {
background-color: #fff;
content: '';
height: 100%;
position: absolute;
top: 0;
transition: all $transition-time;
}
}
&-top {
transform: rotate(45deg);
transform-origin: top left;
&:after {
left: 100%;
right: 0;
transition-delay: $transition-time;
}
}
&-bottom {
transform: rotate(-45deg);
transform-origin: bottom left;
&:after {
left: 0;
right: 100%;
transition-delay: 0s;
}
}
&:hover & {
&-top:after {
left: 0;
transition-delay: 0s;
}
&-bottom:after {
right: 0;
transition-delay: $transition-time;
}
}
&:active {
transform: translateX(-50%) translateY(-50%) scale(0.9);
}
}
https://codepen.io/Kaehler/pen/QWajVgr

How to change font sizes in Weebly Embed code?

I'm currently doing a school project, and I need to use Weebly to build a website.
Using Weebly's "embed code" section type, I put some code (that I stole off the internet) into the embed code area. The code is basically meant to show text whenever you hover your mouse over an image, however I'm having problems actually changing the font size. When I host it on my ide/browser, Font Size works fine, but when I host it on weebly, the font size is massive (and covers up the image. Does anyone know how to fix this?
Code here:
<!DOCTYPE html>
<html lang="en">
<style>
#import url(https://fonts.googleapis.com/css?family=Roboto:100,700;);
.snip1585 {
background-color: #000;
color: #fff;
display: inline-block;
font-family: 'Roboto', sans-serif;
font-size: 18;
margin: 10px;
max-width: 315px;
min-width: 230px;
overflow: hidden;
position: relative;
text-align: center;
width: 100%;
}
.snip1585 * {
-webkit-box-sizing: border-box;
box-sizing: border-box;
-webkit-transition: all 0.45s ease;
transition: all 0.45s ease;
}
.snip1585:before,
.snip1585:after {
background-color: rgba(0, 0, 0, 0.5);
border-top: 50px solid rgba(0, 0, 0, 0.5);
border-bottom: 50px solid rgba(0, 0, 0, 0.5);
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
content: '';
-webkit-transition: all 0.3s ease;
transition: all 0.3s ease;
z-index: 1;
opacity: 0;
}
.snip1585:before {
-webkit-transform: scaleY(2);
transform: scaleY(2);
}
.snip1585:after {
-webkit-transform: scaleY(2);
transform: scaleY(2);
}
.snip1585 img {
vertical-align: top;
max-width: 100%;
backface-visibility: hidden;
}
.snip1585 figcaption {
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
align-items: center;
z-index: 1;
display: flex;
flex-direction: column;
justify-content: center;
line-height: 1.1em;
opacity: 0;
z-index: 2;
-webkit-transition-delay: 0s;
transition-delay: 0s;
}
.snip1585 h3 {
font-size: 1em;
font-weight: 400;
letter-spacing: 1px;
margin: 0;
text-transform: uppercase;
}
.snip1585 h3 span {
display: block;
font-weight: 700;
}
.snip1585 a {
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
z-index: 3;
}
.snip1585:hover>img,
.snip1585.hover>img {
opacity: 0.7;
}
.snip1585:hover:before,
.snip1585.hover:before,
.snip1585:hover:after,
.snip1585.hover:after {
-webkit-transform: scale(1);
transform: scale(1);
opacity: 1;
}
.snip1585:hover figcaption,
.snip1585.hover figcaption {
opacity: 1;
-webkit-transition-delay: 0.1s;
transition-delay: 0.1s;
}
</style>
<figure class="snip1585">
<img src="http://www.applet-magic.com/unemploy.jpg" />
<figcaption>
<h3>"The first statistic for demonstrating the decline of the economy into depression is the unemployment rate"<span>Courtesy of "San Jose University"(Watkins, The Depression of the 1930's and Its Origins or Causes )</span></h3>
</figcaption>
</figure>
</html>

CSS Hover - Not aplying to certain element

I'm quite new to coding and I'm having trouble with the "hover".
It opens already on other parts of the website, but not on the specific location I want. Also it somehow stays opened after hovering and leaving the position. Does someone know why? :)
.pill1 {
position: absolute;
left: 300px;
top:10px;
opacity: 1;
display: block;
transition: .5s ease;
backface-visibility: hidden;
}
.middle {
transition: .5s ease;
opacity: 0;
position: absolute;
top: 15%;
left: 38%;
transform: translate(-50%, -50%);
-ms-transform: translate(-50%, -50%);
text-align: center;
z-index: 100;
}
.container:hover .pill1 {
}
.container:hover .middle {
opacity: 1;
}
.text {
background-color: rgba(22, 32, 162, 0.44);
color: rgba(242, 0, 255, 0.55);
font-family: Akzidenz-Grotesk Pro, bold;
font-size: 20px;
padding: 16px 32px;
width: 300px;
}
<div class="container">
<img src="images/xanax0001.png" alt="Avatar" class="pill1" >
<div class="middle">
<div class="text">"....".</div>
</div>

Hyperlink can't be clicked under div

I've tried experimenting with z-index and position:relative but I can't seem to get this to work.
I've made it so once you hover your mouse over the images, a hyperlink appears, but for some reason you can't click the hyperlink. Can someone please show me how to bring it to the front?
Here's my code:
.caption {
display: inline-block;
position: relative;
overflow: hidden;
-webkit-transform: translateZ(0);
margin-right: 1.25em;
margin-top: 1.250em;
margin-bottom: 2.188em;
margin-left: 1.25em;
top: 0;
bottom: 0;
right: 0;
display: block;
max-width: 100%;
height: auto;
}
.caption::before {
content: ' ';
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
background: transparent;
transition: background .35s ease-out;
}
.imageh:hover+.caption::before {
box-shadow: inset 0 0 0 1000px rgba(0, 0, 0, .5);
}
.imageh {
position: absolute;
display: block;
height: 100%;
width: 100%;
z-index: 1;
top: 0;
bottom: 0;
right: 0;
}
.caption__overlay {
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
padding: 10px;
color: white;
-webkit-transform: translateY(100%);
transform: translateY(100%);
transition: -webkit-transform .35s ease-out;
transition: transform .35s ease-out;
}
.imageh:hover+.caption .caption__overlay {
-webkit-transform: translateY(0);
transform: translateY(0);
}
.caption__media {
padding-top: 130px;
max-width: 100%;
}
<span class="imageh"></span>
<div class="caption">
<img src="http://bsnscb.com/data/out/78/27073638-free-farm-wallpapers.jpg" />
<div class="caption__overlay">
<div class="caption__overlay__content">
<h1 style="text-align:center" class="caption__media"><a style="color:white;" href="artists.html">OUR ARTISTS</a></h1>
</div>
</div>
</div>
Thanks
Instead of using the span element on hover which is a sibling to the image container(making it hard to avoid flickering during hover). You can just hover on the caption container div itself. See sample code below
.caption {
display: inline-block;
position: relative;
overflow: hidden;
-webkit-transform: translateZ(0);
margin-right: 1.25em;
margin-top: 1.250em;
margin-bottom: 2.188em;
margin-left: 1.25em;
top: 0;
bottom: 0;
right: 0;
display: block;
max-width: 100%;
height: auto;
}
.caption::before {
content: ' ';
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
background: transparent;
transition: background .35s ease-out;
}
.caption:hover::before {
box-shadow: inset 0 0 0 1000px rgba(0, 0, 0, .5);
}
.imageh {
/* position: absolute;
display: block;
height: 100%;
width: 100%;
z-index: 1;
top: 0;
bottom: 0;
right: 0;*/
}
.caption__overlay {
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
padding: 10px;
color: white;
-webkit-transform: translateY(100%);
transform: translateY(100%);
transition: -webkit-transform .35s ease-out;
transition: transform .35s ease-out;
}
.caption:hover .caption__overlay {
-webkit-transform: translateY(0);
transform: translateY(0);
}
.caption__media {
padding-top: 130px;
max-width: 100%;
}
<span class="imageh"></span>
<div class="caption">
<img src="https://homepages.cae.wisc.edu/~ece533/images/arctichare.png" />
<div class="caption__overlay">
<div class="caption__overlay__content">
<h1 style="text-align:center" class="caption__media"><a style="color:white;" href="artists.html">OUR ARTISTS</a></h1>
</div>
</div>
</div>
Keep everything as is except two things. Set the element with class "imageh" with z-index 0 and the element with class "caption__overlay__content" with z-index 1.

How to center align text over CSS shape?

For navigation, I opted to use CSS shapes rather than images with overlaid text. However, in every browser, the text appears misaligned towards the right.
Preview on jsFiddle
HTML code:
<nav id="globalNav">
<ul>
<li>
<div class="stars"></div>
<a id="navHome">home</a>
</li>
<li>
<div class="stars"></div>
<a id="navWork">work</a>
</li>
<li>
<div class="stars"></div>
<a id="navAbout">about</a>
</li>
</ul>
</nav>
CSS code:
#globalNav {
position: fixed;
z-index: 1;
width: 100%;
height: 100px;
top: 0;
left: 0;
overflow: hidden;
background-color: #1b2326;
color: #2A363B;
}
#globalNav ul {
margin: 1.25em auto;
padding: 0;
position: relative;
-webkit-padding-start: 0;
-moz-padding-start: 0;
text-align: center;
}
#globalNav li {
padding: 0 3.5em;
display: inline-block;
}
#globalNav a {
position: absolute;
top: 1.3em;
padding: 0 0.25em;
-moz-padding-start: 0;
font-size: 1em;
text-transform: uppercase;
color: #FECEA8;
}
#globalNav a:hover {
position: absolute;
top: 1.3em;
padding: 0 0.25em;
-moz-padding-start: 0;
font-size: 1em;
text-transform: uppercase;
color: #ED6161;
-webkit-transition: .3s ease-in;
-moz-transition: .3s ease-in;
-ms-transition: .3s ease-in;
-o-transition: .3s ease-in;
transition: .3s ease-in;
}
/* dodecagram stars */
.stars {
background: #2A363B;
width: 60px;
height: 60px;
position: relative;
}
.stars:before, .stars:after {
content: "";
position: absolute;
top: 0;
left: 0;
height: 60px;
width: 60px;
background: #2A363B;
}
.stars:before {
-webkit-transform: rotate(30deg);
-moz-transform: rotate(30deg);
-ms-transform: rotate(30deg);
-o-transform: rotate(30deg);
}
.stars:after {
-webkit-transform: rotate(60deg);
-moz-transform: rotate(60deg);
-ms-transform: rotate(60deg);
-o-transform: rotate(60deg);
}
I already searched the forum (i.e., Center text with background CSS “shape”), however the solution didn't work for me.
Add the following CSS to your <a> tags inside the shapes and they will align in the center of the shape :)
position: absolute;
top: 1.3em;
-moz-padding-start: 0;
font-size: 1em;
text-transform: uppercase; /* Also, note that I removed the padding */
color: #FECEA8;
display: block;
width: 60px;
word-wrap: break-word;
}
http://jsfiddle.net/TVkNK/7/
Adding text-align:center to the css did it for me. I also used padding-top to add appropriate padding for vertical centering.