css transition on the Ipad with text - html

I am working on a project for my self. I made some img with a hover transition.
It works perfect in all browsers. But not on the ipad. Why? For some reasons i cant click on the the image because of the text. I dont know why that is. I got 2 examples:
Example 1:
http://jewelbeast.com/imghover/ If you test this 1 on the ipad and you click on the img. You will see that nothing happends. Because the text in Centered with vertical align and with text-align:.
Example 2
http://jewelbeast.com/imghover/test.html if you test this 1 on the ipad you can click on the right side of the image. Because there is no text on the right side.
CSS
div.hover-img-vertical-smallborder{
margin-top: 25px;
height: 400px;
width: 228px;
float: left;
display: block;
margin-left: 10px;
}
div.hover-img-vertical-smallborder section{
position: relative;
width: 217px;
height: 350px;
border: 5px solid white;
outline: 1px solid #c8c8c8;
float:left;
text-align: center;
-webkit-transition: all .3s;
-moz-transition: all .3s;
-ms-transition: all .3s;
-o-transition: all .3s;
transition: all .3s;
overflow: hidden;
background: #dfdfdf;
}
div.hover-img-vertical-smallborder section:hover{
height: 380px;
margin-top: -15px;
}
div.hover-img-vertical-smallborder section img{
position: absolute;
-webkit-transition: all .3s;
-moz-transition: all .3s;
-ms-transition: all .3s;
-o-transition: all .3s;
transition: all .3s;
}
div.hover-img-vertical-smallborder section .text{
position: absolute;
top: 0;
left: 0;
display: table;
height: 100%;
}
div.hover-img-vertical-smallborder section span{
width: 200px;
display: table-cell;
vertical-align: middle;
padding: 20px;
text-align: center;
color: black;
opacity: 0;
text-shadow: 1px 1px 0px rgba(255,255,255,0.3);
-webkit-transition: all .3s;
-moz-transition: all .3s;
-ms-transition: all .3s;
-o-transition: all .3s;
transition: all .3s;
}
div.hover-img-vertical-smallborder section:hover span{
opacity: 1;
}
div.hover-img-vertical-smallborder section:hover img{
opacity: 0.5;
}
div.hover-img-vertical-smallborder section span h1{
width: 100%;
text-align: center;
font-size: 18px;
font-family: Verdana, sans-serif;
font-weight: bold;
line-height: 25px;
margin-bottom: 3px;
}
div.hover-img-vertical-smallborder section span p{
width: 100%;
text-align: center;
font-size: 10px;
font-family: Verdana, sans-serif;
font-weight: bold;
margin-bottom: 10px;
}
div.hover-img-vertical-smallborder section span a.button{
display: table;
margin: 0px auto;
text-align: center;
color: white;
text-shadow: none !important;
text-decoration: none;
font-size: 10px;
font-family: Verdana, sans-serif;
font-weight: bold;
padding: 9px 10px 11px 10px;
border: 1px solid #616161;
outline: 1px solid #000000;
background: #494949; /* Old browsers */
background: -moz-linear-gradient(top, #494949 1%, #3a3a3a 94%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(1%,#494949), color-stop(94%,#3a3a3a)); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, #494949 1%,#3a3a3a 94%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, #494949 1%,#3a3a3a 94%); /* Opera 11.10+ */
background: -ms-linear-gradient(top, #494949 1%,#3a3a3a 94%); /* IE10+ */
background: linear-gradient(to bottom, #494949 1%,#3a3a3a 94%); /* W3C */
}
div.hover-img-vertical-smallborder section span a.entire{
width: 100%;
position: absolute;
top: 0px;
left: 0px;
height: 100%;
}
HTML
<div class="hover-img-vertical-smallborder">
<section class="bg-black"> <!-- bg-black is a black background on hover normal is grey -->
<img src="img/img_5.jpg" style="left: -50%;"/>
<div class="text">
<span>
<h1>This is a title</h1>
</span>
</div>
</section>
</div>
I hope somebody can figure this out.
Thanks.

There is no hover event fired on a touch device. You need to use either one of these events in JS:
touchstart
touchmove
touchend
touchcancel

Related

Nav bar to the side going down content to right; does not go to the right side it goes under the nav bar in the left side

the menu class name is in the navBar compoent
and the center info is in one of the tab that open it in the code here is a link to my github.
https://github.com/aalsaedi265/CyberWebpage
The goal to have the nar bar be on the left side and when I click a tab, the content will appear on the right side.
right know it appears on the nav bar
:root{
--red-scanline: rgba(204,94,98,0.2);
--black-scanline: rgba(1,1,1,0.9);
--yellow: #f7f500;
--red-glow: rgba(211,87,91, 0.91);
--blue: #61e4fa;
}
*{
box-sizing: border-box;
}
html,body{
margin: 0;
height: 100%;
display: block;
}
body{
background-image: url("./pictureFile/Day.png");
/* color: white; */
background-size: cover;
}
.menu {
margin-left: 150px;
width: 400px;
height: 100%;
display: inline-block;
/* this is was i used to get the background for the meue */
background: repeating-linear-gradient(
to bottom,
transparent 0%,
var(--red-scanline)1px,
var(--red-scanline)4px,
var(--red-scanline)5px,
transparent 0.5%
),
repeating-linear-gradient(
to left,
var(--black-scanline),
var(--black-scanline) 100%
);
}
.logo{
color:#f7f500;
font-family:'Cyberpunk';
font-size:42px;
line-height: 1.5;
text-align: center;
text-shadow: rgb(0,208,255) 2px 3px 0px;
padding:25px;
}
.sublogo{
font-family:Cyberpunk;
font-size:26px;
color: rgb(0,208,255);
text-shadow: none;
text-align:right;
letter-spacing:17px;
/* a lttle left so not so stuck */
padding-right:15px;
}
.menu li{
list-style-type: none;
padding: 0px 25px;
}
.Center_page_info{ //this is the content compenent css
display: grid;
grid-template-columns: repeat(2, 1fr);
overflow: none;
gap: 1.5rem;
width: 100%;
margin-bottom: 5rem;
width:800px;
margin: 0 auto;
}
.the_list{ //this is the nav bar css
float:left;
}
.menu ul li{
text-transform: uppercase;
cursor:pointer;
/* font related*/
color:rgba(211,87,91,0.81);
font-family:Cyberpunk;
letter-spacing:4.0px;
font-size:23px;
text-shadow: 0px 0px 3px var(--red-glow);
/*border*/
border-style: solid;
border-width: 2px;
border-color: var(--blue);
border-color: transparent;
/*layout*/
position: relative;
padding: 10px;
margin:15px 0px;
width: 350px;
height:54.5px;
clip-path: polygon(350px 0px, 350px 29px, 322px 57px, 0px 57px, 0px 0px);
/* Animation */
transition: color 1s ease-out;
transition: border-color 1s ease-out
}
.menu ul li:hover::after,
.menu ul li:hover{
color:var(--blue);
border-color: var(--blue);
/*transition*/
transition:color 0.23s linear;
transition:border-color 0.23s linear;
}
.menu ul li::after{
content: "";
width:30px;
height: 30px;
position:absolute;
transform:rotate(45deg);
bottom:-17px;
right: -17px;
/*border*/
border-width: 2px;
border-style:solid;
border-color: transparent;
/* Animation */
transition: color 1s ease-out;
transition: border-color 1s ease-out;
}

How to properly centralize span inside a button?

I'm trying to give the look of a gradient border to a button by creating a span inside the button and setting some padding difference between them.
It works pretty well on codepen, but when I pass it to my website, something happens and these tags suddenly stop being aligned.
However, which is the best way to set a span centralized inside a button in order to simulate a border?
body{
background:white;
text-align:center;
box-sizing:border-box;
font-family:"Lato",Sans-serif;
padding-top:5%;
/* position:relative; */
}
.btn:link,
.btn:visited{
text-decoration: none;
text-transform:uppercase;
position:relative;
top:0;
left:0;
padding:22px 2px;
border-radius:100px;
display:inline-block;
transition: all .5s;
}
.btn-white{
background-image:linear-gradient(56deg, #08AEEA 0%, #2AF598 100%);
color:#000;
font-family: Lato;
font-size:1.3rem;
}
.btn span {
align-items: center;
background-color: #fff;
border-radius:100px;
display: absolute;
justify-content: center;
padding:20px 40px;
height: 100%;
transition: background .5s ease;
width: 100%;
}
.btn:hover span {
background: transparent;
}
.btn:hover{
background-image: linear-gradient(56deg, #08AEEA 0%, #2AF598 100%);
border: none;
box-shadow:0px 10px 10px rgba(0,0,0,0.2);
color: #fff;
transform : translateY(-3px);
}
.btn:active{
box-shadow:0px 5px 10px rgba(0,0,0,0.2)
transform:translateY(-1px);
}
.btn-bottom-animation-1{
animation:comeFromBottom 1s ease-out .8s;
}
.btn::after{
content:"";
text-decoration: none;
text-transform:uppercase;
position:absolute;
width:100%;
height:100%;
top:0;
left:0;
border-radius:100px;
display:inline-block;
z-index:-1;
transition: all .5s;
}
.btn-white::after {
background-image: linear-gradient(56deg, #08AEEA 0%, #2AF598 100%);
background-color: #fff;
}
.btn-animation-1:hover::after {
transform: scaleX(1.4) scaleY(1.6);
opacity: 0;
}
#keyframes comeFromBottom{
0%{
opacity:0;
transform:translateY(40px);
}
100%{
opacity:1;
transform:translateY(0);
}
}
<a class="btn" href="#">
<span>A brand new button!</span>
</a>
Well if it worked in Codepen and now doesn't its because your site is overriding something or you're not including the reset/normalize or vendor prefixing that Codepen is using by default.
Now you shouldn't need to do any "centering" to accomplish what I think you want.
Simply make the span a block level element and give it a margin or give the button padding.
button {
background-color: blue;
border: 2px solid darkBlue;
font-size: 14px;
padding: 4px;
}
button span {
display:block;
background: tan;
border:2px solid aqua;
padding: 10px 20px;
color: white;
}
<button>
<span>Text</span>
</button>
May be this is the solution that you intended to achieve. I have to edit a lot to your code to achieve that. Here is Codepen version
body {
background: white;
text-align: center;
box-sizing: border-box;
font-family: "Lato", Sans-serif;
padding-top: 5%;
/* position:relative; */
}
.btn:link,
.btn:visited {
text-decoration: none;
text-transform: uppercase;
/* position: relative; */
/* top: 0; */
/* left: 0; */
padding: 10px;
/* this padding will be your gradient border */
border-radius: 100px;
display: inline-block;
transition: all .5s;
border: none;
}
.btn:hover {
background-image: linear-gradient(56deg, #08AEEA 0%, #2AF598 100%);
/* border: none; */
box-shadow: 0px 10px 10px rgba(0, 0, 0, 0.2);
/* color: #fff; */
transform: translateY(-3px);
}
.btn span {
/* align-items: center; */
background-color: transparent;
/* background-color: #fff; */
border-radius: 100px;
/* display: absolute; */
/* justify-content: center; */
/* padding: 20px 40px; */
/* padding: 20px; */
/* height: 100%; */
/* transition: background .5s ease; */
transition: all .5s ease;
/* width: 100%; */
display: block;
padding: 20px 40px;
}
.btn:hover span {
/* background: transparent; */
background: #fff;
color: #ccc;
}
/* .btn-white {
background-image: linear-gradient(56deg, #08AEEA 0%, #2AF598 100%);
color: #000;
font-family: Lato;
font-size: 1.3rem;
} */
/*
.btn:active {
box-shadow: 0px 5px 10px rgba(0, 0, 0, 0.2);
transform: translateY(-1px);
}
.btn-bottom-animation-1 {
animation: comeFromBottom 1s ease-out .8s;
} */
/* .btn::after {
content: "";
text-decoration: none;
text-transform: uppercase;
position: absolute;
width: 100%;
height: 100%;
top: 0;
left: 0;
border-radius: 100px;
display: inline-block;
z-index: -1;
transition: all .5s;
} */
/*
.btn-white::after {
background-image: linear-gradient(56deg, #08AEEA 0%, #2AF598 100%);
background-color: #fff;
}
.btn-animation-1:hover::after {
transform: scaleX(1.4) scaleY(1.6);
opacity: 0;
}
#keyframes comeFromBottom {
0% {
opacity: 0;
transform: translateY(40px);
}
100% {
opacity: 1;
transform: translateY(0);
}
}
*/
<a class="btn" href="#">
<span>A brand new button!</span>
</a>

-webkit-box-reflect disappears while transitioning

I'm looking for a solution for this:
When the image starting the transition it loses the reflection till the end, when it comes back.
What am I missing? Thanks!
.specials-box {
width: 330px;
margin: 50px 0;
height: 500px;
position: relative;
cursor: pointer;
}
.special-img {
width: 80%;
position: absolute;
top: 20px;
left: 10%;
transition: all 0.3s ease-in-out;
-webkit-box-reflect: below 0px -webkit-gradient(linear, left top, left bottom, from(transparent), color-stop(70%, transparent) , to(rgba(250, 250, 250, 0.3)));
transition: all 0.3s ease-in-out;
filter: grayscale(100%);
}
.specials-box:hover .special-img {
filter: grayscale(0%);
top:0;
transition: all 0.3s ease-in-out;
-webkit-box-reflect: below 25px -webkit-gradient(linear, left top, left bottom, from(transparent), color-stop(70%, transparent) , to(rgba(250, 250, 250, 0.3)));
}
<div class="specials-box">
<img class="special-img" src="https://koktelbolt.shoprenter.hu/custom/koktelbolt/image/data/specials/4.png" />
</div>
Gradients don't support transitions yet (although the current spec says they should support like gradient to like gradient transitions via interpolation.).
just posted an example for understanding
.year {
display: inline-block;
padding: 10px 15px;
cursor: pointer;
text-align: center;
color: #fff;
font-size: 17px;
border-radius: 20px;
background: rgba(5,176,196,1);
background: -webkit-linear-gradient(170deg, #05b0c4, #80ff8f);
background: -o-linear-gradient(170deg, 170deg, #05b0c4, #80ff8f);
background: -moz-linear-gradient(170deg, 170deg, #05b0c4, #80ff8f);
background: linear-gradient(170deg, #05b0c4, #80ff8f);
transition:all 0.4s linear;
}
.year:hover {
background: rgba(5,176,196,1);
background: -webkit-linear-gradient(170deg, #80ff8f, #05b0c4);
background: -o-linear-gradient(170deg, #80ff8f, #05b0c4);
background: -moz-linear-gradient(170deg, #80ff8f, #05b0c4);
background: linear-gradient(170deg, #80ff8f, #05b0c4);
}
<div class="year">2017</div>
You can use pseudo classes for it
.button {
display: inline-block;
margin-top: 10%;
padding: 1em 2em;
font-size: 2em;
color: #fff;
font-family: arial, sans-serif;
text-decoration: none;
border-radius: 0.3em;
position: relative;
background-color: #ccc;
background-image: linear-gradient(to top, #6d8aa0, #8ba2b4);
-webkit-backface-visibility: hidden;
z-index: 1;
}
.button:after {
position: absolute;
content: '';
top: 0;
left: 0;
width: 100%;
height: 100%;
border-radius: 0.3em;
background-image: linear-gradient(to top, red, blue);
transition: opacity 0.5s ease-out;
z-index: 2;
opacity: 0;
}
.button:hover:after {
opacity: 1;
}
.button span {
position: relative;
z-index: 3;
}
body {
text-align: center;
background: #ddd;
}
<a class="button" href="#"><span>BUTTON</span></a>

Align one of two strings in DIV to be centered

I want text which is written "This text needs to be in middle" to be positioned in the center.
You can view the problem in more detail by clicking the link below:
http://dabblet.com/gist/aadbfca153ec45c6633f
I tried to solve it with <span> tags.
You can use position: absolute; to achieve this. First set the container .option-header to position: relative;, and then the text on the right to position: absolute;. Then all you have to do is move it to the right with right: 0;. You can remove the float.
See the following snippet or your adjusted dabblet.
.option-header{
height: 76px;
width: 591px;
margin: 0 0 14px;
font-size: 32px;
/* padding-bottom: 8px; */
padding: 1px 0px;
text-align: center;
color: white;
font-size: 30px;
font-weight: 600;
padding: 20px 8px;
height: auto;
/* display: inline-block; */
-o-transition: .4s;
-ms-transition: .4s;
-moz-transition: .4s;
-webkit-transition: .4s;
/* transition: .4s; */
font-family: 'Alegreya SC',serif;
color: #fefefe;
border-radius: 0 0 6px 6px;
overflow: hidden;
border: 2px solid #e2e2e2!important;
background: #D85D1E;
position: relative;
}
.najjeftinija{
height: 39px;
background: rgb(110, 165, 38);
padding: 1px 0px;
}
.najjeftinija span{
padding-right: 5px;
font-size: 23px;
padding-top: 5px;
font-family: cursive;
}
.cijenadesno{
position: absolute;
right: 0;
}
<div class="option-header najjeftinija width-100"><span>This needs to be in middle </span><span class="cijenadesno">4.95 KM</span></div>
Just change the margin from margin: 0 0 14px; to margin: auto;
Full code
.option-header{
height: 76px;
width: 591px;
margin: auto; /* <-- Change here */
font-size: 32px;
/* padding-bottom: 8px; */
padding: 1px 0px;
text-align: center;
color: white;
font-size: 30px;
font-weight: 600;
padding: 20px 8px;
height: auto;
/* display: inline-block; */
-o-transition: .4s;
-ms-transition: .4s;
-moz-transition: .4s;
-webkit-transition: .4s;
/* transition: .4s; */
font-family: 'Alegreya SC',serif;
color: #fefefe;
border-radius: 0 0 6px 6px;
overflow: hidden;
border: 2px solid #e2e2e2!important;
background: #D85D1E;
}

Nonexistent right margin on float: right item?

I've got this bit of HTML:
<div id="content">
<h1 id="prompt">What's on your mind?</h1>
<form action="post.php" method="POST" id="message-form">
<textarea placeholder="Type in anything you want to share. Anything at all."></textarea>
<p>Feel free to type up to <span id="character-count">2000 characters</span>, or to use Markdown formatting.</p>
<input type="submit" class="submit button" value="Share" />
<br class="clearfix" />
</form>
</div>
and this CSS:
/* CSS Reset
-------------------------------------------*/
* {
margin: 0;
padding: 0;
}
.clearfix {
clear: both;
}
/* UI Elements
-------------------------------------------*/
.button {
background-color: #ccc;
background-image: -webkit-linear-gradient(white, #ccc);
background-image: -moz-linear-gradient(white, #ccc);
background-image: -ms-linear-gradient(white, #ccc);
background-image: -o-linear-gradient(white, #ccc);
background-image: linear-gradient(white, #ccc);
border: 1px solid #999;
border-radius: 10px;
color: #333;
cursor: pointer;
font-family: Arial, Helvetica, Sans-serif;
font-size: 13px;
outline: none;
padding: 3px 8px;
text-decoration: none;
}
.button:hover {
border-color: #666;
}
.button:active {
background-color: #bbb;
background-image: -webkit-linear-gradient(#ccc, white);
background-image: -moz-linear-gradient(#ccc, white);
background-image: -ms-linear-gradient(#ccc, white);
background-image: -o-linear-gradient(#ccc, white);
background-image: linear-gradient(#ccc, white);
}
/* Content
-------------------------------------------*/
#content {
margin: 10px;
}
/* Prompt
-------------------------------------------*/
#prompt {
color: #888;
font-weight: normal;
}
/* Message Box
-------------------------------------------*/
#message-form {
width: 600px;
}
#message-form textarea {
border: 1px solid #ccc;
border-radius: 6px;
display: block;
font-family: Georgia, Times New Roman, Times, Serif;
font-size: 16px;
min-height: 100px;
outline: none;
padding: 5px;
resize: vertical;
width: 100%;
-webkit-transition: border-color 0.25s ease-in-out;
-moz-transition: border-color 0.25s ease-in-out;
-ms-transition: border-color 0.25s ease-in-out;
-o-transition: border-color 0.25s ease-in-out;
transition: border-color 0.25s ease-in-out;
}
#message-form textarea:hover {
border-color: #666;
}
#message-form textarea:focus {
border-color: #3bf;
box-shadow: 0 0 5px #3bf;
}
#message-form p {
color: #666;
float: left;
font-size: 13px;
margin: 3px;
}
#message-form .submit {
float: right;
margin-right: 0;
}
What I'm trying to accomplish is to float an element rightwards within a particular amount of space. This works, but there's about 10 pixels' space to the right of the button that don't appear to exist! It's not padding from the parent element, nor margin on the button as far as I can see... so where is it coming from? Below is an image of the problem, and the full code can be found at https://github.com/minitech/MiniTicket. Here's a demo on jsFiddle, too.
Sorry for the overload of code, but I can't seem to reproduce the problem in a simple way.
Keep in mind that setting width: 100% and any amount of horizontal padding will cause your element to have a width beyond 100% (unless it's an input element, in which padding is applied inside of the element).
In your case, your textarea width is 610px. The submit button is properly floated to the far right of your 600px width container.
See: http://jsfiddle.net/Wexcode/KX7wd/1/
Replacement for padding in textarea: http://jsfiddle.net/Wexcode/KX7wd/2/