img flickering on css picture wall - php

im doing this project for university. i'm currently facing a minor problem but yet disturbing.
link to site: http://haw.finekost.com/ws2013/PP_HATE_SITE/
CSS:
.box {
filter: grayscale(1);
float: left;
height: 0;
margin: 0;
moz-filter: grayscale(1);
ms-filter: grayscale(1);
o-filter: grayscale(1);
opacity: 0.5;
padding-bottom: 20%;
position: relative;
webkit-filter: grayscale(1);
width: 20%;
}
.box:hover {
cursor: pointer;
moz-filter: all .5s ease-in-out;
opacity: 1;
webkit-filter: grayscale(0);
webkit-transition: all .5s ease-in-out;
}
img {
height: 100%;
left: 0;
position: absolute;
width: 100%;
}
the boxes are generated via php.
the image boxes change in size (just 1px) when i hover them. i really dont know why they do it. Hopefully someone can help me

it appears to be related to the webkit transition filter in your .box:hover
Maybe this will help?
Prevent flicker on webkit-transition of webkit-transform
actually if you add -webkit-backface-visibility: hidden; to the box:hover css it appears this will fix the problem.

It is happening due to your webkit-transition style rule setup on your box:hover selector.
If you take it out, then there is no 'flicker'. THe reason it does not happen in Firefox is because you do not have a firefox vendor property set there such as -moz-transition.
Why do you need a transition in this case ?

In your website you use for .box a width of 20%. It looks like this causes somehow a 1px gap. However this could be solved by using width: 20vw for .box.
vw is viewport width in % this removed the 1px border.
So use:
.box {
filter: grayscale(1);
float: left;
height: 0;
margin: 0;
moz-filter: grayscale(1);
ms-filter: grayscale(1);
o-filter: grayscale(1);
opacity: 0.5;
position: relative;
webkit-filter: grayscale(1);
padding-bottom: 20vw;
width: 20vw;
}

Related

:checked not working in css

Context:
I've been working on the front and back-end for a fun startup company for the last month. There is a profile page on the website for users who are logged in. As shown below in its default state:
Default state
Using the 'checkbox' hack / trick, by clicking on the setting icon (as referenced through the label tag in the css below) The logged in user can open a side menu, with settings and options for their account as shown below:
The menu expanded
The problem:
Clicking on the profile text is supposed to create a drop-down menu so that the user can upload their own profile picture. I was hoping to do this through the same checkbox hack as before. However, when clicking on the profile text (referenced as h1), the checkbox is ticked but the background (referenced as .sidebar h1) doesn't change its colour to red. I think this is because of a problem with the :checked function in css, because when I click on the profile text I can see the checkbox become checked and unchecked.
Of note:
I can use javascript, but it's really not preferable (the person I'm working for isn't a big fan.)
Here is the whole file: https://pastebin.com/E0H6HgRe
CSS
.sidebar {
background-color: white;
position: fixed;
top: 0;
width: 0;
bottom: 0;
}
input#slide-sidebar[type="checkbox"] {
display: none;
}
input#slide-sidebar:checked ~ .sidebar{
left: 0;
width: 201;
z-index: 3;
-webkit-transition: width 2s;
transition: width 2s;
}
.setting {
font-size: 100px;
color:black;
z-index: 0;
background-color:white;
position: fixed;
left: 18.8%;
width: 100%;
}
input#slide-sidebar:not(:checked) ~ .sidebar {
width: 0;
-webkit-transition: width 2s;
transition: width 2s;
}
h1{
color: #222;
font-size: 20;
letter-spacing: 1px;
text-decoration: none;
text-transform: uppercase;
color:black;
left: 0px;
opacity:0;
position: fixed;
top: 200px;
}
input#slide-sidebar:checked ~ .sidebar h1 {
opacity: 1;
transition: opacity 1s ease-in;
-webkit-transition: opacity 1s ease-in;
}
input#slide-sidebar:not(:checked) ~ .sidebar h1 {
opacity: 0;
transition: opacity 0.5s ease-out;
-webkit-transition: opacity 0.5s ease-out;
}
input#profile-pic:checked ~ .sidebar h1 {
background-color: red;
}
Php (html running inside php)
echo "<div class='main-wrap'><input id='slide-sidebar' type = 'checkbox' role='button' /> <label for='slide-sidebar' class='setting'><span><i class = 'fa fa-cog'></i></span></label><div class='sidebar'>
<input id='profile-pic' type = 'checkbox' role='button' /><label for='profile-pic'><span><h1> Profile</h1></span></label></div>";

rotate and move image to the right when hovering over another div

I want to hover over an image (music album) and then a record rolls out, so I want it to move to the right and to rotate a bit. It can already move to the right but I can't get it to rotate with it.
the #cover1 is the album and the #coverrecord1 is the record that needs to roll out, i like to keep it as simple as possible as i am not a pro in coding.
Many thanks.
$(document).ready(function (){
$("#cover1").hover(
function() {
$("#coverrecord1").stop().animate({ left: '5%' });
},
function() {
$("#coverrecord1").stop().animate({ left: '0' });
}
);
});
You can also skip js if you wish :)
.album {
background-color: orange;
height: 10em;
margin: 3em auto;
position: relative;
width: 10em;
}
.album:after, .album:before {
content: "";
display: block;
height: 100%;
left: 0;
position: absolute;
top: 0;
width: 100%;
}
.album:after {
background-color: orange;
z-index: 1;
}
.album:before {
background-image: linear-gradient(to left, gray, black);
border-radius: 50%;
transition: transform 500ms;
}
.album:hover:before {
transform: translate3d(40%, 0%, 0) rotate(30deg);
}
<div class="album"></div>

fill circle on depending on percentage ( mailing template )

I'm preparing a custom mailing, through php, and I need to prepare four custom circles, filled on depending on some percentages ( which I receive them dinamically ), so I need some html tags for do it:
Firstly, I thought in canvas tag, but I read that a lot of email clients don't support canvas tag: https://www.campaignmonitor.com/blog/email-marketing/2013/08/support-for-html-5-elements-in-email/
So, I thought in svg tag, but now I realize that, for do the calculation of the percentage, I need javascript to do it, and mail clients don't support javascript either.
So, I understand that I can't do it to mailing templates, right?
Thanks you very much!
Following code snnippet may work for you
CSS
/**
* HTML5 / CSS3 Circle with Partial Border
* http://stackoverflow.com/q/13059190/1397351
*/
* { margin: 0; padding: 0; }
.circle {
position: relative;
margin: 7em auto;
width: 16em; height: 16em;
border-radius: 50%;
background: lightblue;
}
.arc {
overflow: hidden;
position: absolute;
top: -1em; right: 50%; bottom: 50%; left: -1em;
transform-origin: 100% 100%;
transform: rotate(45deg) skewX(30deg);
}
.arc:before {
box-sizing: border-box;
display: block;
border: solid 1em navy;
width: 200%; height: 200%;
border-radius: 50%;
transform: skewX(-30deg);
content: '';
}
HTML
<!-- content to be placed inside <body>…</body> -->
<div class='circle'>
<div class='arc'></div>
</div>

Can I change the value of PHP variables in CSS hover selection?

everyone. I have a problem using CSS and PHP.
Here is the code:
.book {
width:100px;
height:50px;
background-image: url(outside2.png);
position: absolute;
left: 557px;
top: 70px;
}
.book:hover > .right {
visibility:visible;
opacity:1;
transition-delay:0s;
<?php $pos = 1 ?>
}
.right {
width: 300px;
height: 200px;
background-image: url(r2.png);
position: absolute;
left: 100px;
top: -50px;
visibility:hidden;
opacity:0;
transition:visibility 0s linear 0.2s,opacity 0.2s linear;
}
I want the variable $pos's value change to 1 when users move their mouse on the div.
But $pos always be 1 no matter where my mouse is.
Do I use the wrong way to design this website?
I think you have two options. One is to change the value with javascript and then submit it with AJAX. The other one is to change the value with javascript in a hidden field and then submit it with the form.

Gallery Image Transition

I wonder whether someone may be able to help me please.
I'm using Aurigma Image Uploader and FancyBox to produce this gallery page. The problem I'm having is that the images are positioned to go vertically down the page, whereas I would prefer them to go horizontally across the page, creating separate rows of images, one underneath the other.
I appreciate that some may not know anything about the Aurigma package, but I think I'm right in saying that 'Fancybox' is a little more widely used.
I just wondered whether someone could perhaps provide somne guidance please on the settings I would need to change within the Fancybox script so that the images are positioned horizontally rather than vertically.
Many thanks
.ccs file extract
.gallery-image-list { padding: 0; list-style-type: none; }
.gallery-image-list .item { display: inline-block; vertical-align: top; margin: 5px; padding: 15px; white-space: nowrap; width: 150px; float:left; }
.gallery-image-list .wide-item { width: 250px; }
.gallery-image-list .item .preview { display: inline-block; vertical-align: top; }
.gallery-image-list .item .data { margin: 5px; padding: 5px; list-style-type: none; display: inline-block; vertical-align: top; font-size: 95%; }
.gallery-image-list .item .data li { margin-bottom: 5px; }
I think what you want is to add float:left; to your item class in css.

Categories