I have create a pop up using only CSS and HTML it works fine as i need and here is code
.wrap {
padding: 40px;
text-align: center;
}
hr {
clear: both;
margin-top: 40px;
margin-bottom: 40px;
border: 0;
border-top: 1px solid #aaaaaa;
}
h1 {
font-size: 30px;
margin-bottom: 40px;
}
p {
margin-bottom: 20px;
}
.btn {
background: #428bca;
border: #357ebd solid 1px;
border-radius: 3px;
color: #fff;
display: inline-block;
font-size: 14px;
padding: 8px 15px;
text-decoration: none;
text-align: center;
min-width: 60px;
position: relative;
transition: color .1s ease;
}
.btn:hover {
background: #357ebd;
}
.btn.btn-big {
font-size: 18px;
padding: 15px 20px;
min-width: 100px;
}
.btn-close {
color: #aaaaaa;
font-size: 30px;
text-decoration: none;
position: absolute;
right: 5px;
top: 0;
}
.btn-close:hover {
color: #919191;
}
.modal:before {
content: "";
display: none;
background: rgba(0, 0, 0, 0.6);
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
z-index: 10;
}
.modal:target:before {
display: block;
}
.modal:target .modal-dialog {
-webkit-transform: translate(0, 0);
-ms-transform: translate(0, 0);
transform: translate(0, 0);
top: 20%;
}
.modal-dialog {
background: #fefefe;
border: #333333 solid 1px;
border-radius: 5px;
margin-left: -200px;
position: fixed;
left: 50%;
top: -100%;
z-index: 11;
width: 360px;
-webkit-transform: translate(0, -500%);
-ms-transform: translate(0, -500%);
transform: translate(0, -500%);
-webkit-transition: -webkit-transform 0.3s ease-out;
-moz-transition: -moz-transform 0.3s ease-out;
-o-transition: -o-transform 0.3s ease-out;
transition: transform 0.3s ease-out;
}
.modal-body {
padding: 20px;
}
.modal-header,
.modal-footer {
padding: 10px 20px;
}
.modal-header {
border-bottom: #eeeeee solid 1px;
}
.modal-header h2 {
font-size: 20px;
}
.modal-footer {
border-top: #eeeeee solid 1px;
text-align: right;
}
<div class="wrap">
pop up!
</div>
<!-- Modal -->
<div class="modal" id="modal-one" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-header">
<h2>Modal in CSS?</h2>
×
</div>
<div class="modal-body">
<p>One modal example here! :D</p>
</div>
<div class="modal-footer">
Nice!
</div>
</div>
</div>
Jsfiddle
My problem is when i click pop up entire page scroll down to bottom and pop up appears
since i have lot of content in my page
i need to open pop up on same place i don't want the page to scroll down can some one help whats wrong
NOTE when you try with the above code you can only find scroll little bit
but in my page it scroll to bottom of page
I don't know if I understand it correctly but try to add sth like that:
body.unscrollable {
overflow:hidden;
}
and add class .unscrollable when modal is open.
It will disable scrolling on website body.
Related
Hi I'm trying to make a simple text pop-up button using just html and CSS. I looked at a bunch of examples but most of them use JavaScript in some way so I cant use them. found some that is pure CSS but when I tried them, they all do this weird thing where closing the pop-up brings me to top of page. Any help is appreciated. Thanks
jsfiddle: http://jsfiddle.net/hjrudc5n/
This is my HTML
```
<div class="box"><a class="button" href="#popup1">Show Overlay</a></div>
<div id="popup1" class="overlay">
<div class="popup">
<h2>Title</h2>
<a class="close" href="#">×</a>
<div class="content">Content</div>
</div>
</div>
</div>
and this is my CSS
/*pop up overlay */
.box {
width: 20%;
margin: 0 auto;
background: rgba(255, 255, 255, 0.2);
padding: 35px;
border: 2px solid #fff;
border-radius: 20px/50px;
background-clip: padding-box;
text-align: center;
}
.button {
font-size: 1em;
padding: 10px;
color: #fff;
border: 2px solid blue;
border-radius: 20px/50px;
text-decoration: none;
cursor: pointer;
transition: all 0.3s ease-out;
}
.button:hover {
background: blue;
}
.overlay {
position: fixed;
top: 0;
bottom: 0;
left: 0;
right: 0;
background: rgba(0, 0, 0, 0.7);
transition: opacity 500ms;
visibility: hidden;
opacity: 0;
}
.overlay:target {
visibility: visible;
opacity: 1;
}
.popup {
margin: 70px auto;
padding: 20px;
background: #fff;
border-radius: 5px;
width: 30%;
position: relative;
transition: all 5s ease-in-out;
}
.popup h2 {
margin-top: 0;
color: #333;
font-family: Tahoma, Arial, sans-serif;
}
.popup .close {
position: absolute;
top: 20px;
right: 30px;
transition: all 200ms;
font-size: 30px;
font-weight: bold;
text-decoration: none;
color: #333;
}
.popup .close:hover {
color: orange;
}
.popup .content {
max-height: 30%;
overflow: auto;
}
Check this out:
http://jsfiddle.net/aj43psdw/13/
The problem with your code was that using "#" as an href will always take you to the top of the page, no matter what. Also, makes thing hard to control.
What you can do. is work with labels and checkboxes, and control the "state" of things via that.
Like this:
[name="popup"]{
width:0;
height:0;
overflow:hidden;
position:relative;
z-index:-1;
pointer-events:none;
}
[name="popup"]:checked ~ .overlay{
visibility: visible;
opacity: 1;
}
In the fiddle I linked you, clicking the button will check the checkbox, that we'll show via css. the X button will do the same, unchecking it.
It was because of href="#" of the anchor tag you were using, which led to going to top of page on closing the popup.
A workaround is to use <input type="checkbox" /> (so that you can use :checked selector) along with <label>(so that you can still interact with checkbox after hiding it), to hide, and unhide the popup.
/*pop up overlay */
.box {
width: 20%;
margin: 0 auto;
background: rgba(255, 255, 255, 0.2);
padding: 35px;
border: 2px solid #fff;
border-radius: 20px/50px;
background-clip: padding-box;
text-align: center;
}
.button {
font-size: 1em;
padding: 10px;
color: #fff;
border: 2px solid blue;
border-radius: 20px/50px;
text-decoration: none;
cursor: pointer;
transition: all 0.3s ease-out;
}
.button:hover {
background: blue;
}
.overlay {
position: fixed;
top: 0;
bottom: 0;
left: 0;
right: 0;
background: rgba(0, 0, 0, 0.7);
transition: opacity 500ms;
visibility: hidden;
opacity: 0;
}
#pop:checked + .overlay {
visibility: visible;
opacity: 1;
}
.popup {
margin: 70px auto;
padding: 20px;
background: #fff;
border-radius: 5px;
width: 30%;
position: relative;
transition: all 5s ease-in-out;
}
.popup h2 {
margin-top: 0;
color: #333;
font-family: Tahoma, Arial, sans-serif;
}
.popup .close {
position: absolute;
top: 20px;
right: 30px;
transition: all 200ms;
font-size: 30px;
font-weight: bold;
text-decoration: none;
color: #333;
}
.popup .close:hover {
color: orange;
}
.popup .content {
max-height: 30%;
overflow: auto;
}
#pop{
display: none; /*Hide the checkbox*/
}
<div class="box"><label class="button" for="pop">Show Overlay</label></div>
<input type="checkbox" id="pop" />
<div id="popup1" class="overlay">
<div class="popup">
<h2>Title</h2>
<label class="close" for="pop">×</label>
<div class="content">Content</div>
</div>
</div>
I just downloaded an HTML and CSS template online and want to modify the code to adjust the hamburger menu icon to the right and have the menu slide from the right side but I had no idea about which part I should change
I have attached a screenshot of the interface below for reference. Thanks!
/*menu*/
#menuToggle
{
display: block;
position: relative;
top: 50px;
left: 50px;
z-index: 1;
-webkit-user-select: none;
user-select: none;
}
#menuToggle a
{
text-decoration: none;
color: #232323;
transition: color 0.3s ease;
}
#menuToggle a:hover
{
color: tomato;
}
#menuToggle input
{
display: block;
width: 40px;
height: 32px;
position: absolute;
top: -7px;
left: -5px;
cursor: pointer;
opacity: 0; /* hide this */
z-index: 2; /* and place it over the hamburger */
-webkit-touch-callout: none;
}
/*
* Just a quick hamburger
*/
#menuToggle span
{
display: block;
width: 33px;
height: 4px;
margin-bottom: 5px;
position: relative;
background: #cdcdcd;
border-radius: 3px;
z-index: 1;
transform-origin: 4px 0px;
transition: transform 0.5s cubic-bezier(0.77,0.2,0.05,1.0),
background 0.5s cubic-bezier(0.77,0.2,0.05,1.0),
opacity 0.55s ease;
}
#menuToggle span:first-child
{
transform-origin: 0% 0%;
}
#menuToggle span:nth-last-child(2)
{
transform-origin: 0% 100%;
}
/*
* Transform all the slices of hamburger
* into a crossmark.
*/
#menuToggle input:checked ~ span
{
opacity: 1;
transform: rotate(45deg) translate(-2px, -1px);
background: #ffffff;
}
/*
* But let's hide the middle one.
*/
#menuToggle input:checked ~ span:nth-last-child(3)
{
opacity: 0;
transform: rotate(0deg) scale(0.2, 0.2);
}
/*
* Ohyeah and the last one should go the other direction
*/
#menuToggle input:checked ~ span:nth-last-child(2)
{
transform: rotate(-45deg) translate(0, -1px);
}
/*
* Make this absolute positioned
* at the top left of the screen
*/
#menu
{
position: absolute;
width: 300px;
margin: -100px 0 0 -50px;
padding: 50px;
padding-top: 125px;
background: #ededed;
list-style-type: none;
-webkit-font-smoothing: antialiased;
/* to stop flickering of text in safari */
transform-origin: 0% 0%;
transform: translate(-100%, 0);
transition: transform 0.5s cubic-bezier(0.77,0.2,0.05,1.0);
}
#menu li
{
padding: 10px 0;
font-size: 22px;
}
/*
* And let's slide it in from the left
*/
#menuToggle input:checked ~ ul
{
transform: none;
}
/*----------------------------------menu----------------------------*/
.section {
position: relative;
height: 100vh;
}
.section .section-center {
position: absolute;
top: 50%;
left: 0;
right: 0;
-webkit-transform: translateY(-50%);
transform: translateY(-50%);
}
#booking {
font-family: 'Montserrat', sans-serif;
background-image: url('../img/dog.jpeg');
background-size: cover;
background-position: center;
}
#booking::before {
content: '';
position: absolute;
left: 0;
right: 0;
bottom: 0;
top: 0;
background: rgba(143, 215, 230, 0.6);
}
.booking-form {
background-color: #fff;
padding: 60px 20px;
-webkit-box-shadow: 0px 5px 20px -5px rgba(0, 0, 0, 0.3);
box-shadow: 0px 5px 20px -5px rgba(0, 0, 0, 0.3);
border-radius: 4px;
}
.booking-form .form-group {
position: relative;
margin-bottom: 30px;
}
.booking-form .form-control {
background-color: #ebecee;
border-radius: 4px;
border: none;
height: 40px;
-webkit-box-shadow: none;
box-shadow: none;
color: #3e485c;
font-size: 14x;
}
.booking-form .form-control::-webkit-input-placeholder {
color: rgba(62, 72, 92, 0.3);
}
.booking-form .form-control:-ms-input-placeholder {
color: rgba(62, 72, 92, 0.3);
}
.booking-form .form-control::placeholder {
color: rgba(62, 72, 92, 0.3);
}
.booking-form input[type="date"].form-control:invalid {
color: rgba(62, 72, 92, 0.3);
}
.booking-form select.form-control {
-webkit-appearance: none;
-moz-appearance: none;
appearance: none;
}
.booking-form select.form-control+.select-arrow {
position: absolute;
right: 0px;
bottom: 4px;
width: 40px;
line-height: 32px;
height: 32px;
text-align: center;
pointer-events: none;
color: rgba(62, 72, 92, 0.3);
font-size: 14px;
}
.booking-form select.form-control+.select-arrow:after {
content: '\279C';
display: block;
-webkit-transform: rotate(90deg);
transform: rotate(90deg);
}
.booking-form .form-label {
display: inline-block;
color: #3e485c;
font-weight: 700;
margin-bottom: 6px;
margin-left: 7px;
}
.booking-form .submit-btn {
display: inline-block;
color: #fff;
background-color: #1e62d8;
font-weight: 700;
padding: 14px 30px;
border-radius: 4px;
border: none;
-webkit-transition: 0.2s all;
transition: 0.2s all;
}
.booking-form .submit-btn:hover,
.booking-form .submit-btn:focus {
opacity: 0.9;
}
.booking-cta {
margin-top: 80px;
margin-bottom: 30px;
}
.booking-cta h1 {
font-size: 52px;
text-transform: uppercase;
color: #fff;
font-weight: 700;
}
.booking-cta p {
font-size: 20px;
color: rgba(255, 255, 255, 0.8);
}
footer {
position: relative;
height: 0px;
width: 100%;
background-color: #333333;
}
p.copyright {
position: absolute;
width: 100%;
color: #fff;
line-height: 40px;
font-size: 0.7em;
text-align: center;
bottom:0;
}
HTML Code:
<nav role="navigation">
<div id="menuToggle">
<!--
A fake / hidden checkbox is used as click reciever,
so you can use the :checked selector on it.
-->
<input type="checkbox" />
<!--
Some spans to act as a hamburger.
They are acting like a real hamburger,
not that McDonalds stuff.
-->
<span></span>
<span></span>
<span></span>
<ul id="menu">
<li>Home</li>
<li>About</li>
<li>Info</li>
<li>Contact</li>
</ul>
</div>
</nav>
<div id="booking" class="section">
<div class="section-center">
<div class="container">
<div class="row">
<div class="col-md-7 col-md-push-5">
<div class="booking-cta">
<h1>Bring Your Pet to Work</h1>
<p>Caring and Loving Pet service
</p>
</div>
</div>
<div class="col-md-4 col-md-pull-7">
<div class="booking-form">
<form>
<div class="form-group">
<span class="form-label">Where do you work? </span>
<input class="form-control" type="text" placeholder="Enter an address or zipcode">
</div>
<div class="row">
<div class="col-sm-6">
<div class="form-group">
<span class="form-label">Drop off</span>
<input class="form-control" type="date" required>
</div>
</div>
<div class="col-sm-6">
<div class="form-group">
<span class="form-label">Pick up</span>
<input class="form-control" type="date" required>
</div>
</div>
</div>
<div class="row">
<div class="col-sm-4">
<div class="form-group">
<span class="form-label">Pet?</span>
<select class="form-control">
<option>Cat</option>
<option>Dog</option>
<option>Others</option>
</select>
<span class="select-arrow"></span>
</div>
</div>
<div class="col-sm-4">
<div class="form-group">
<span class="form-label">Service</span>
<select class="form-control">
<option>Day Care</option>
<option>Boarding</option>
<option>Sitting</option>
</select>
<span class="select-arrow"></span>
</div>
</div>
</div>
<div class="form-btn">
<button class="submit-btn">Check availability</button>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
</div>
//about the white space try set the margin-top of the body at 0;
//about the the hamberger icon try this:
nav {
display:flex;
flex-direction: flex-end; }
To move the hamburger to the right side, make sure your #menuToggle position is fixed or absolute, then removeleft: 50px; and add right: 50px; and if you want more top space you can increase top attribute value, ex: top: 100px; or top: 0; if you don't want any top space.
I've commented the CSS bellow, in case you were wondering what i've changed.
Here is the CSS code you should use: (I've tested it and it's working for me)
#menuToggle {
display: block;
position: fixed;
top: 50px; /** NOTE: decrease The pixels if want less space */
right: 50px;/** NOTE: Change This line */
z-index: 1;
-webkit-user-select: none;
user-select: none;
}
#menuToggle a {
text-decoration: none;
color: #232323;
transition: color 0.3s ease;
}
#menuToggle a:hover {
color: tomato;
}
#menuToggle input {
display: block;
width: 40px;
height: 32px;
position: absolute;
top: -7px;
left: -5px;
cursor: pointer;
opacity: 0;
/* hide this */
z-index: 2;
/* and place it over the hamburger */
-webkit-touch-callout: none;
}
/*
* Just a quick hamburger
*/
#menuToggle span {
display: block;
width: 33px;
height: 4px;
margin-bottom: 5px;
position: relative;
background: #cdcdcd;
border-radius: 3px;
z-index: 1;
transform-origin: 4px 0px;
transition: transform 0.5s cubic-bezier(0.77, 0.2, 0.05, 1.0),
background 0.5s cubic-bezier(0.77, 0.2, 0.05, 1.0),
opacity 0.55s ease;
}
#menuToggle span:first-child {
transform-origin: 0% 0%;
}
#menuToggle span:nth-last-child(2) {
transform-origin: 0% 100%;
}
/*
* Transform all the slices of hamburger
* into a crossmark.
*/
#menuToggle input:checked~span {
opacity: 1;
transform: rotate(45deg) translate(-2px, -1px);
background: #ffffff;
}
/*
* But let's hide the middle one.
*/
#menuToggle input:checked~span:nth-last-child(3) {
opacity: 0;
transform: rotate(0deg) scale(0.2, 0.2);
}
/*
* Ohyeah and the last one should go the other direction
*/
#menuToggle input:checked~span:nth-last-child(2) {
transform: rotate(-45deg) translate(0, -1px);
}
/*
* Make this absolute positioned
* at the top left of the screen
*/
#menu {
position: absolute;
width: 300px;
margin: -100px 0 0;/** NOTE: Change this line */
padding: 50px;
padding-top: 125px;
right: -50px; /*NOTE: Add this line */
background: #ededed;
list-style-type: none;
-webkit-font-smoothing: antialiased;
/* to stop flickering of text in safari */
transform-origin: 0% 0%;
transform: translateX(100%);/** NOTE: Change this line */
transition: transform 0.5s cubic-bezier(0.77, 0.2, 0.05, 1.0);
}
#menu li {
padding: 10px 0;
font-size: 22px;
}
/*
* And let's slide it in from the left
*/
#menuToggle input:checked~ul {
transform: none;
}
/*----------------------------------menu----------------------------*/
This question already has answers here:
Keep the pseudo element in between the background and main content
(1 answer)
Avoid z-index working relative to the parent element
(1 answer)
Closed 4 years ago.
I am trying create a hover effect using CSS. Here is the link: http://creativeartbd.com/demo/test.html
Here is the code:
/* GENERAL BUTTON STYLING */
button,
button::after {
-webkit-transition: all 0.3s;
-moz-transition: all 0.3s;
-o-transition: all 0.3s;
transition: all 0.3s;
}
button {
background: none;
border: 3px solid red;
border-radius: 5px;
color: red;
display: block;
font-size: 1.6em;
font-weight: bold;
margin: 1em auto;
padding: 2em 6em;
position: relative;
text-transform: uppercase;
}
button::before,
button::after {
background:red;
content: '';
position: absolute;
z-index: -1;
}
button:hover {
color: black;
}
/* BUTTON 5 */
.btn-5 {
overflow: hidden;
}
.btn-5::after {
/*background-color: #f00;*/
height: 100%;
left: -35%;
top: 0;
transform: skew(50deg);
transition-duration: 0.6s;
transform-origin: top left;
width: 0;
}
.btn-5:hover:after {
height: 100%;
width: 135%;
}
<button class="btn-5">Button 5</button>
now if you run it you can see that there is style when you hover over the button. Now I want to set initial background for this button. So that IF I set the background here:
button {
background: orange;
}
If I do so then the effect is not showing.
Can you tell me why and how can I solve it?
JSFiddle
add z-index:0 to the element to create a stacking context and keep the pseudo element inside. You can then add background
/* GENERAL BUTTON STYLING */
button,
button::after {
-webkit-transition: all 0.3s;
-moz-transition: all 0.3s;
-o-transition: all 0.3s;
transition: all 0.3s;
}
button {
background: none;
border: 3px solid red;
border-radius: 5px;
color: red;
display: block;
font-size: 1.6em;
font-weight: bold;
margin: 1em auto;
padding: 2em 6em;
position: relative;
z-index:0;
background:orange;
text-transform: uppercase;
}
button::before,
button::after {
background:red;
content: '';
position: absolute;
z-index: -1;
}
button:hover {
color: black;
}
/* BUTTON 5 */
.btn-5 {
overflow: hidden;
}
.btn-5::after {
/*background-color: #f00;*/
height: 100%;
left: -35%;
top: 0;
transform: skew(50deg);
transition-duration: 0.6s;
transform-origin: top left;
width: 0;
}
.btn-5:hover:after {
height: 100%;
width: 135%;
}
<button class="btn-5">Button 5</button>
You can also simplify your code like follow:
button {
background: none;
border: 3px solid red;
border-radius: 5px;
color: red;
display: block;
font-size: 1.6em;
font-weight: bold;
margin: 1em auto;
padding: 2em 6em;
background:
linear-gradient(50deg,red 50%,transparent 50.5%),
orange;
background-size:250% 100%;
background-position: right;
text-transform: uppercase;
transition: all 0.5s;
}
button:hover {
color: black;
background-position: left;
}
<button class="btn-5">Button 5</button>
I got this problem with safari browser when I used to transform with perspective to parent "parent". these blocks work well with chrome and Mozilla!
any help?
my code and a screenshot from safari below
enter image description here
.service-element {
text-align: center;
padding: 28px;
perspective: 298px;
position: absolute;
padding-left: 56px;
transition: all .5s ease-in-out;
padding-bottom: 60px;
padding-top: 60px;
}
.service-element:before {
content: '';
position: absolute;
right: 0;
bottom: 0;
left: 0;
top: 0;
z-index: -1;
background-color: #ffffff;
border: solid 0.5px #e3e0e0;
border-radius: 24px;
transition: all .5s ease-in-out;
box-shadow: 0 2px 5px 0 rgba(0, 0, 0, 0.225);
-webkit-transform: rotateY(-10deg);
transform: rotateY(-10deg);
}
.service-element img {
height: 89px;
margin-bottom: 31px;
}
.service-element h2 {
font-size: 22px;
font-family: "indielabs-Frutiger-bold";
color: #4c4c4c;
}
.service-element .paragraph {
font-size: 14px;
color: #959595;
font-family: "indielabs-Frutiger-light";
}
<div class="service-element tr">
<img src="http://yehia.alyomhost.net/alyom-new/images/apps-icon#3x.jpg" class="img-fluid">
<h2>تصميم تطبيقات الجوال</h2>
<div class="paragraph">
لوريم ابيسوم نص عشواىي هنا يوضح الشكل وليس الهدف منه المحتوي
</div>
I watched the tutorial Pure CSS Animated Modal/Lightbox. I was able to get the right result even when I changed the modal's corresponding link to an image. The problem is, whenever I add another image and link it to a different modal, the bottom part of both modal shows up when I open the page. Something like this. (Image 1) This also happens when I click on the images. (Image 2) Image Link
I placed all image modal links inside a pure css tab. And here're the codes I used.
EDIT (Full CSS I'm using on my page)
body {
background-image: url('https://lh4.googleusercontent.com/-MohfCSihE2I/VGRnxqZNuFI/AAAAAAAAADE/SgiIb4GEIY8/s2048/back.gif');
background-color: white;
color: black;
font-size: 16px;
font-family: trebuchet ms, helvetica, sans-serif;
letter-spacing: 3px;
}
#font-face {
font-family: bf-font;
src: url(http://bf.amebagames.com/font/bf-font.woff") format('woff');
}
.bf {
font-family: bf-font;
}
.cardbg {
background-image: url('https://lh3.googleusercontent.com/-kV3vTS7WzFQ/Vq8iIGo8mOI/AAAAAAAADS4/qv3O9n1L0gI/s2048-Ic42/cmnTitleRed.png');
text-align: center;
color: #FFF;
border-radius: 3px;
}
.cardattri {
font-family: bf-font;
font-size: 26px;
text-align: center;
}
.cardtitle {
font-size: 20px;
color: #FFF;
text-align: center;
}
.story {
background-image: url('https://lh3.googleusercontent.com/-AVgAM5nK6ec/Vq8iIDN1uyI/AAAAAAAADSw/dThSw3Re6-E/s2048-Ic42/bg%252520brown.png');
width: 200px;
height: 26px;
margin: 0px 75px;
border-radius: 5px;
}
/* TABS */
.tabs {
list-style-type: none;
padding: 0;
margin: 0;
position: relative;
}
.tabs:after {
content: "";
clear: both;
display: block;
height: 542px;
}
.tabs li {
float: left;
}
.tabs li > input {
display: none;
}
.tabs li > label {
display: inline-block;
border: 1px solid #000;
border-right-width: 0;
border-bottom-width: 0;
height: 30px;
line-height: 30px;
padding: 5px 20px;
cursor: pointer;
}
.tabs li:last-child > label {
border-right-width: 1px;
}
.tabs .tab-content {
display: none;
position: absolute;
left: 0;
padding: 20px;
border: 1px solid #000;
width: 768px;
height: 500px;
overflow-y: scroll;
}
/* TABS Functional */
.tabs li > input:checked + label {
background-color: #DDD;
}
.tabs li > input:checked ~ .tab-content {
display: block;
}
/* MODAL */
.modal-container {
position: fixed;
background-color: #FFF;
background-image: url('https://lh3.googleusercontent.com/-J73bzJ9PVJE/Vq8iIGmBxlI/AAAAAAAADS0/-uNM7fG2sI4/s2048-Ic42/bg_new%252520no%252520border%2525202.png');
width: 100%;
max-width: 350px;
height: 100%;
max-height: 550px;
left: 50%;
padding: 5px;
border: 2px solid #512d2d;
border-radius: 5px;
-webkit-transform: translate(-50%, 200%);
-ms-transform: translate(-50%, 200%);
transform: translate(-50%, 200%);
-webkit-transition: -webkit-transform 200ms ease-out;
transition: transform 200ms ease-out;
}
.modal:before {
content: "";
position: fixed;
display: none;
background-color: rgba(0,0,0,.8);
top: 0;
left: 0;
height: 100%;
width: 100%
}
.modal:target:before {
display: block;
}
.modal:target .modal-container {
top: 18%;
-webkit-transform: translate(-50%, 0);
-ms-transform: translate(-50%, 0);
transform: translate(-50%, 0);
}
a.boxclose {
float: right;
margin-right: -18px;
margin-top: -16px;
width: 22px;
height: 22px;
text-align: center;
text-decoration: uppercase;
color: #947a4e;
font-size: 20px;
border-radius: 12px;
background-color: #FFF;
box-shadow: 0px 0px 2px
rgba(0,0,0,0.4);
}
a.boxclose:link {
text-decoration: none;
}
.boxclose::before {
content: "";
}
#modal-close {}
/* CARD ANIMATION */
.panel {
width: 350px;
height: 438px;
margin: auto;
position: relative;
-moz-border-radius: 0px 50px 0px 50px;
-webkit-border-radius: 0px 50px 0px 50px;
-o-border-radius: 0px 50px 0px 50px;
border-radius: 0px 50px 0px 50px;
-webkit-transition: all .7s ease;
-moz-transition: all .7s ease;
-o-transition: all .7s ease;
overflow: hidden;
}
.card {
width: 350px;
height: 438px;
-o-transition: all .5s;
-ms-transition: all .5s;
-moz-transition: all .5s;
-webkit-transition: all .5s;
transition: all .5s;
-webkit-backface-visibility: hidden;
-ms-backface-visibility: hidden;
-moz-backface-visibility: hidden;
backface-visibility: hidden;
position: absolute;
top: 0px;
left: 0px;
}
.front {
z-index: 2;
background-repeat: no-repeat;
width: 230px;
-moz-border-radius: 0px 50px 0px 50px;
-webkit-border-radius: 0px 50px 0px 50px;
-o-border-radius: 0px 50px 0px 50px;
border-radius: 0px 50px 0px 50px;
}
.back {
z-index: 1;
-webkit-transform: rotateY(180deg);
-ms-transform: rotateY(180deg);
-moz-transform: rotateY(180deg);
transform: rotateY(180deg);
background-repeat: no-repeat;
width: 230px;
-moz-border-radius: 50px 0px 50px 0px;
-webkit-border-radius: 50px 0px 50px 0px;
-o-border-radius: 50px 0px 50px 0px;
}
.panel:hover {
-moz-border-radius: 50px 0px 50px 0px;
-webkit-border-radius: 50px 0px 50px 0px;
-o-border-radius: 50px 0px 50px 0px;
border-radius: 50px 0px 50px 0px;
-webkit-transition: all .7s ease;
-moz-transition: all .7s ease;
-o-transition: all .7s ease;
overflow: hidden;
}
.panel:hover .front {
z-index: 1;
-webkit-transform: rotateY(-180deg);
-ms-transform: rotateY(-180deg);
-moz-transform: rotateY(-180deg);
transform: rotateY(-180deg);
}
.panel:hover .back {
z-index: 2;
-webkit-transform: rotateY(0deg);
-ms-transform: rotateY(0deg);
-moz-transform: rotateY(0deg);
transform: rotateY(0deg);
}
HTML code
<ul class="tabs">
<li>
<input type="radio" name="tabs" id="king" checked>
<label for="king">King</label>
<div class="tab-content">
<img src="https://lh3.googleusercontent.com/-REZUMNTK5vA/VINOSxepDYI/AAAAAAAACA4/2ixTyaJIp4U/s2048-Ic42/1a.jpg" width="250px"><br>
<img src="https://lh3.googleusercontent.com/-e2gN0x-vlr8/VVDGF5XpVzI/AAAAAAAACA4/b1SibabLkpA/s2048-Ic42/11a.jpg" width="250px">
<div class="modal" id="saku">
<div class="modal-container">
<span class="bf">x</span>
<div class="cardbg">
<span class="cardattri">q</span>
<span class="cardtitle">[ミダラな寝相] Saku Kagami (SSR)</span>
</div><br>
<div class="story" style="font-size: 14px; text-align: center;"><img src="https://lh3.googleusercontent.com/-UFyiWZmr1AA/VGRnyG-RtQI/AAAAAAAAADU/LWENjijPlMA/s2048-Ic42/icon_story.png" width="14px" height="16px"> 何を想像した?</div><br>
<div class="panel">
<div class="front card">
<img src="https://lh3.googleusercontent.com/-REZUMNTK5vA/VINOSxepDYI/AAAAAAAACA4/2ixTyaJIp4U/s2048-Ic42/1a.jpg" alt="SSR1 Card" width="350px" height="438px">
</div>
<div class="back card">
<img src="https://lh3.googleusercontent.com/-r3CHpi4DxSw/VfVhhUpmDaI/AAAAAAAACA4/VldO2dZdhno/s2048-Ic42/1c.jpg" alt="SSR 1 CG" width="350x" height="438px">
</div>
</div><br>
</div>
</div>
<div class="modal" id="ssr">
<div class="modal-container">
<span class="bf">x</span>
<div class="cardbg">
<span class="cardattri">q</span>
<span class="cardtitle">[ミダラな寝相] Saku Kagami (SSR)</span>
</div><br>
<div class="story" style="font-size: 14px; text-align: center;"><img src="https://lh3.googleusercontent.com/-UFyiWZmr1AA/VGRnyG-RtQI/AAAAAAAAADU/LWENjijPlMA/s2048-Ic42/icon_story.png" width="14px" height="16px"> 何を想像した?</div><br>
<div class="panel">
<div class="front card">
<img src="https://lh3.googleusercontent.com/-e2gN0x-vlr8/VVDGF5XpVzI/AAAAAAAACA4/b1SibabLkpA/s2048-Ic42/11a.jpg" alt="SSR1 Card" width="350px" height="438px">
</div>
<div class="back card">
<img src="https://lh3.googleusercontent.com/-d_7dx1qF0Pc/VfViJRPBiEI/AAAAAAAACA4/UairgGEi-jc/s2048-Ic42/11c.jpg" alt="SSR 1 CG" width="350x" height="438px">
</div>
</div><br>
</div>
</div>
</div>
</li>
</ul>
How do I fix this?
Note: The modal contains a lot of div because I included a card animation on the content.
If you replace the images inside the anchor tags with just standard text it works fine, as so:
Link One
Link Two
The issue is therefore likely to be in your CSS, where something is conflicting, with the image elements you are putting inside.
You might need to post your full code so people on here can get a bit of a better idea as to what is going on.