I would like to apply a different style to my slideshow. Therefore I found one on the internet, which corresponds to my wishes. I tried to insert it, but unfortunately it doesn't work at all. Do you have any idea how I merge CSS code with my slideshow?
slideshow.js
import React from "react";
import { Gallery, GalleryImage } from "react-gesture-gallery";
const images = [
"https://img-9gag-fun.9cache.com/photo/amBjg8y_700bwp.webp",
"https://img-9gag-fun.9cache.com/photo/abYPGB8_700bwp.webp",
"https://img-9gag-fun.9cache.com/photo/abYPgY8_700bwp.webp",
"https://img-9gag-fun.9cache.com/photo/az9NeXq_700bwp.webp",
"https://img-9gag-fun.9cache.com/photo/aPYNZ4Q_700bwp.webp"
];
function Slider() {
const [index, setIndex] = React.useState(0);
return (
<Gallery
style={{
position: "relative",
background: "white",
height: "40vh",
width: "180w"
}}
index={index}
onRequestChange={i => {
setIndex(i);
}}
>
{images.map(image => (
<GalleryImage objectFit="contain" key={image} src={image} />
))}
</Gallery>
);
}
export default Slider;
current css
*,
::after,
::before {
box-sizing: content-box;
}
element.style {
background-color: black;
}
body {
padding: 0px;
}
.App {
font-family: sans-serif;
}
.vertical-timeline-element-icon,
.bounce-in {
box-shadow: 0px 0px transparent;
text-align: center;
margin-bottom: 50px;
}
.adventure {
width: 400px;
}
.vertical-timeline-element-date {
text-align: left;
width: 80%;
}
.img_logo {
width: 60px;
height: 60px;
border-radius: 50%;
}
#media only screen and (min-width: 1170px) {
.vertical-timeline.vertical-timeline--two-columns:before {
left: 50%;
margin-left: -2px;
background: #ddd;
}
}
#media only screen and (max-width: 1172px) {
.vertical-timeline-element-content {
margin-left: 8%;
}
.img_logo {
width: 40px;
height: 40px;
}
}
#media only screen and (max-width: 772px) {
.vertical-timeline-element-content {
margin-left: 14%;
}
}
.loader {
border: 10px solid #bebebe;
border-top: 10px solid #000000;
border-radius: 50%;
width: 70px;
height: 70px;
animation: spin 1s linear infinite;
margin: auto;
margin-top: 20%;
}
.Buttons {
margin-top: 200px;
}
.btn1 {
background-color: #d23c21;
color: white;
padding: 16px 32px;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 18px;
margin: 4px;
cursor: pointer;
border-radius: 6px;
}
.btn2 {
background-color: #3f66cb;
color: white;
padding: 16px 32px;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 18px;
margin: 4px;
cursor: pointer;
border-radius: 6px;
}
.btn3 {
background-color: #f69a1d;
color: white;
padding: 16px 32px;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 18px;
margin: 4px;
cursor: pointer;
border-radius: 6px;
}
.btn4 {
background-color: #4caf50;
color: white;
padding: 16px 32px;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 18px;
margin: 4px 2px;
cursor: pointer;
border-radius: 6px;
}
.App {
font-family: sans-serif;
text-align: center;
color: black;
}
.home {
margin-top: 10%;
text-align: center;
}
.header {
margin-top: 10%;
text-align: center;
}
.Text {
text-align: center;
width: 50%;
font-size: 100%;
margin: 0 auto;
display: flex;
}
.timeline-badge.primary {
background-color: #ffa500 !important;
}
.timeline-badge.success {
background-color: #ffa500 !important;
}
.timeline-badge.warning {
background-color: #ffa500 !important;
}
.timeline-badge.danger {
background-color: #ffa500 !important;
}
.timeline-badge.info {
background-color: #ffa500 !important;
}
.timeline-title {
margin-top: 0;
color: inherit;
}
.timeline-body > p {
margin-bottom: 0;
width: 80px;
font-size: 22px;
align: center;
text-align: center;
margin-left: 40px;
}
.timeline-body > p + p {
margin-top: 5px;
width: 22px;
text-align: center;
}
.same {
font-size: 20px;
}
.home {
margin-top: 10%;
text-align: center;
}
.header {
margin-top: 10%;
text-align: center;
}
.Text {
text-align: center;
width: 50%;
font-size: 100%;
margin: 0 auto;
display: flex;
}
.Logo {
width: 50%;
}
.event {
display: flex;
position: absolute;
width: 100%;
margin-top: -60px;
transition: background-color 1s ease-in;
height: 700px;
}
.Videotext {
text-align: center;
position: relative;
height: 100%;
width: 50%;
font-size: 100%;
margin-top: 0;
margin-left: 2%;
display: 0;
}
.Video {
width: ´100%;
height: 20%;
margin-bottom: 12%;
background-color: "black";
display: block;
float: left;
transition: width 0.8s ease-out, height 0.3s ease-out;
}
.arrow {
width: 0px;
height: 0px;
position: flex;
border: 50px solid transparent;
border-top-color: orange;
margin: 0;
margin-left: -20px;
padding: 0;
float: left;
margin-top: 75px;
display: 0;
animation-name: meine-animation;
animation-duration: 1s;
animation-iteration-count: infinite;
}
#keyframes meine-animation {
0%,
100% {
border-top-color: orange;
}
50% {
border-top-color: white;
}
75% {
border-top-color: orange;
}
}
.arrow.left {
transform: rotate(90deg) translate(0px, 25px);
-webkit-transform: rotate(90deg) translate(0px, 0px);
-moz-transform: rotate(180deg) translate(0px, 25px);
-o-transform: rotate(180deg) translate(0px, 25px);
-ms-transform: rotate(180deg) translate(0px, 25px) translate(0px, 25px);
}
#boxi {
margin-top: 200px;
}
#animation {
color: orange;
padding: 0px;
position: absolute;
margin-top: 100px;
margin-left: -10px;
}
.slider {
display: block;
margin-left: 50%;
margin-top: 10%;
display: flex;
border-color: rgb(0, 108, 197);
border-width: 5px;
border-style: solid;
}
#media only screen and (min-device-width: 320px) and (max-device-width: 480px) {
.slider {
display: block;
width: 130px;
height: 130px;
display: flex;
border-color: rgb(0, 108, 197);
border-width: 5px;
border-style: solid;
}
}
style i want to insert.css
body {
background:url(http://subtlepatterns.subtlepatterns.netdna-cdn.com/patterns/low_contrast_linen.png) repeat;
-webkit-font-smoothing: subpixel-antialiased;
background-color: rgb(243, 243, 243);
}
#warp {
width: 90%;
max-width: 800px;
background: #595959;
margin: 30px auto;
overflow: hidden;
box-shadow: 0 3px 5px rgba(0, 0, 0, 0.75);
-moz-box-shadow: 0 3px 5px rgba(0, 0, 0, 0.75);
-webkit-box-shadow: 0 3px 5px rgba(0, 0, 0, 0.75);
-webkit-border-radius: 3px;
-moz-border-radius: 3px;
border-radius: 3px;
}
ul#gallery-container {
position: relative;
width: 100%;
max-width: 800px;
height: auto;
padding: 52% 0 10px;
margin: 0;
text-align: center;
display: block;
}
li.gallery-item {display: inline-block;width: 10%;cursor:pointer;*display:inline;}
img.gallery-preview{
background: white;
margin: 0;
padding: 5% 5% 15%;
*padding: 2px 2px 10px;
position: relative;
top: 0;
width: 85%;
height: auto;
max-height: 45px;
border-radius: 3px;
-moz-border-radius: 3px;
-webkit-border-radius: 3px;
overflow: hidden;
-webkit-transition: all 0.3s ease-out .2s;
-moz-transition: all 0.3s ease-out .2s;
-o-transition: all 0.3s ease-out .2s;
transition: all 0.3s ease-out .2s;
}
ul#gallery-container:hover li img.gallery-preview{opacity: 0.5;-webkit-filter:blur(2px) grayscale(0.5); }
ul#gallery-container:hover li:hover img.gallery-preview{opacity: 1;-webkit-filter:blur(0px) grayscale(0); }
input.gallery-selector:checked ~ label.gallery-label>img.gallery-preview,
ul#gallery-container:hover li:hover img.gallery-preview:hover{
z-index: 5;
box-shadow: 0 4px 5px rgba(0, 0, 0, 0.75);
-moz-box-shadow: 0 4px 5px rgba(0, 0, 0, 0.75);
-webkit-box-shadow: 0 4px 5px rgba(0, 0, 0, 0.75);
-webkit-transform: scale(1.25);
-moz-transform: scale(1.25);
-o-transform: scale(1.25);
transform: scale(1.25);
-webkit-transform-origin: bottom center;
-moz-transform-origin: bottom center;
-o-transform-origin: bottom center;
transform-origin: bottom center;
-webkit-transition: all 0.3s ease-out;
-moz-transition: all 0.3s ease-out;
-o-transition: all 0.3s ease-out;
transition: all 0.3s ease-out;
}
ul#gallery-container:hover li:hover img.gallery-preview:hover {z-index: 20;}
input.gallery-selector:checked ~ label.gallery-label>img.gallery-preview{background: #333}
input.gallery-selector:checked ~ label.gallery-label:before{
content: " ";
position: relative;
width: 0;
height: 0;
border-left: 10px solid transparent;
border-right: 10px solid transparent;
border-bottom: 20px solid #333;
top: -30px;
}
img.gallery-fullsize {
position: absolute;
top: 0px;
left: 0px;
display: block;
width: 100%;
height: auto;
z-index: -1;
opacity: 0;
-webkit-transform: scale(0.25);
-moz-transform: scale(0.25);
-o-transform: scale(0.25);
transform: scale(0.25);
-webkit-transform-origin: bottom center;
-moz-transform-origin: bottom center;
-o-transform-origin: bottom center;
transform-origin: bottom center;
-webkit-transition: all 0.3s ease-out;
-moz-transition: all 0.3s ease-out;
-o-transition: all 0.3s ease-out;
transition: all 0.3s ease-out;
}
ul#gallery-container:hover li.gallery-item:active img.gallery-fullsize{
z-index: 50;
opacity: 0.75;
-webkit-filter:blur(10px) grayscale(1);
border-radius: 10%;
-webkit-border-radius: 10%;
-moz-border-radius: 10%;
-webkit-transform-origin: bottom center;
-moz-transform-origin: bottom center;
-o-transform-origin: bottom center;
transform-origin: bottom center;
-webkit-transition: all 0.3s ease-out .2s;
-moz-transition: all 0.3s ease-out .2s;
-o-transition: all 0.3s ease-out .2s;
transition: all 0.3s ease-out .2s;
}
ul#gallery-container:hover li:hover input.gallery-selector:checked ~ img.gallery-fullsize{z-index: 10;opacity: 1;border-radius: 0;-moz-border-radius: 0;-webkit-border-radius: 0;}
input.gallery-selector:checked ~ img.gallery-fullsize {
display: block;
opacity: 1;
z-index: 10;
-webkit-transform: scale(1);
-moz-transform: scale(1);
-o-transform: scale(1);
transform: scale(1);
-webkit-transform-origin: top center;
-moz-transform-origin: top center;
-o-transform-origin: top center;
transform-origin: top center;
-webkit-transition: all .2s ease-in .3s;
-moz-transition: all .2s ease-in .3s;
-o-transition: all .2s ease-in .3s;
transition: all .2s ease-in .3s;
}
input.gallery-selector {display: none;}
label.gallery-label {cursor: pointer;}
html from style i want to insert.html
<div id="warp">
<ul id="gallery-container">
<li class="gallery-item">
<input checked="checked" type="radio" name="gallery-list" class="gallery-selector" value="1.jpg" id="gallery-item1" />
<img src="http://lorempixel.com/400/200/sports" class="gallery-fullsize" alt="location bateau 135ch" />
<label for="gallery-item1" class="gallery-label">
<img src="http://lorempixel.com/76/50/sports" class="gallery-preview" alt="location bateau 135ch"/>
</label>
</li>
<li class="gallery-item">
<input type="radio" name="gallery-list" class="gallery-selector" value="2.jpg" id="gallery-item2" />
<img src="http://lorempixel.com/400/200/sports/1" class="gallery-fullsize" alt="location bateau 135ch" />
<label for="gallery-item2" class="gallery-label">
<img src="http://lorempixel.com/76/50/sports/1" class="gallery-preview" alt="location bateau 135ch"/>
</label>
</li>
<li class="gallery-item">
<input type="radio" name="gallery-list" class="gallery-selector" value="3.jpg" id="gallery-item3" />
<img src="http://lorempixel.com/400/200/sports/2" class="gallery-fullsize" alt="location bateau 135ch" />
<label for="gallery-item3" class="gallery-label">
<img src="http://lorempixel.com/76/50/sports/2" class="gallery-preview" alt="location bateau 135ch"/>
</label>
</li>
<li class="gallery-item">
<input type="radio" name="gallery-list" class="gallery-selector" value="4.jpg" id="gallery-item4" />
<img src="http://lorempixel.com/400/200/sports/3" class="gallery-fullsize" alt="location bateau 135ch" />
<label for="gallery-item4" class="gallery-label">
<img src="http://lorempixel.com/76/50/sports/3" class="gallery-preview" alt="location bateau 135ch"/>
</label>
</li>
<li class="gallery-item">
<input type="radio" name="gallery-list" class="gallery-selector" value="5.jpg" id="gallery-item5" />
<img src="http://lorempixel.com/400/200/sports/4" class="gallery-fullsize" alt="location bateau 135ch" />
<label for="gallery-item5" class="gallery-label">
<img src="http://lorempixel.com/76/50/sports/4" class="gallery-preview" alt="location bateau 135ch"/>
</label>
</li>
<li class="gallery-item">
<input type="radio" name="gallery-list" class="gallery-selector" value="6.jpg" id="gallery-item6" />
<img src="http://lorempixel.com/400/200/sports/5" class="gallery-fullsize" alt="location bateau 135ch" />
<label for="gallery-item6" class="gallery-label">
<img src="http://lorempixel.com/76/50/sports/5" class="gallery-preview" alt="location bateau 135ch"/>
</label>
</li>
<li class="gallery-item">
<input type="radio" name="gallery-list" class="gallery-selector" value="7.jpg" id="gallery-item7" />
<img src="http://lorempixel.com/400/200/sports/6" class="gallery-fullsize" alt="location bateau 135ch" />
<label for="gallery-item7" class="gallery-label">
<img src="http://lorempixel.com/76/50/sports/6" class="gallery-preview" alt="location bateau 135ch"/>
</label>
</li>
</ul>
</div>
You'll need to create a css file and import it into the component. to set a classname in the JSX pass a className prop with a string.
example css file
.Class {
opacity: 1;
}
example render method from component
import './example.css'
render(){
<div className="Class">something</div>
}
The full documentation can be found here!
Related
The HTML and CSS I've used to create a website are listed below. I'm currently trying to get it online, but I am having trouble running it on a mobile device. The website works without any problems on my Macbook, but when I try running it via a MAMP server on my iPhone 12, it crashes (freezing and will no longer load properly) after viewing a few pages. When my iPhone is connected to Wi-Fi, it runs as it should. It doesn't run as it should when connected to 4G, even with a good connection.
Would this have anything to do with my website being too heavy to run smoothly on a mobile device? Any advice would be much appreciated.
<!DOCTYPE html>
<html lang="en">
<meta name="viewport" content="width=device-width, initial-scale=1.0;" charset="utf-8">
<body>
<style>html{visibility: hidden; opacity: 0;}</style>
<title>MORIKOBOSHI・</title>
<div class="page-wrap">
<div class="cp_cont">
<input id="cp_toggle03" type="checkbox"/>
<div class="cp_mobilebar">
<label for="cp_toggle03" class="cp_menuicon">
<span></span>
</label>
</div>
<label id="h-menu_black" class="cp_toggle03" for="cp_menuicon"></label>
<div id="body" class="noscroll"></div>
<header class="cp_offcm03">
<nav>
<ul style="text-align: center; margin-left: 210px; overflow: hidden;">
<li style="border-bottom: .05px solid lightgray;">Home</li>
<li style="border-bottom: .05px solid lightgray;">Blog</li>
<li style="border-bottom: .05px solid lightgray;">About This Website</li>
<li style="border-bottom: .05px solid lightgray;">Bibliography</li>
<div class="searchbar">
<form id="frmSearch" class="search2" method="get" action="default.html" style=" padding-right: 10px; padding-top: 20px; text-align: center; position: inline;">
<input class="search2" id="txtSearch" type="text" placeholder="Custom Google Search" name="serach_bar" size="31" maxlength="255" value="" style="top: 185px; width: 180px; height: 26px;">
<input class="search1" type="submit" name="submition" value="Search" style="padding-left: 5px; top: 153px; height: 25px; width: 50px; display: inline-flex; justify-content: center;">
<input class="search2" type="hidden" name="sitesearch" value="default.html">
</form>
</div>
<script type="text/javascript">
document.getElementById('frmSearch').onsubmit = function() {
window.location = 'http://www.google.com/search?q=site:morikoboshi.com' + document.getElementById('txtSearch').value;
return false;
}
</script>
<script>
document.getElementById('cp_toggle03').onchange = function() {
if (document.getElementById('cp_toggle03').checked) {
document.body.style.overflow = "hidden";
} else {
document.body.style.overflow = "";
}
}
if(!!window.performance && window.performance.navigation.type == 2)
{
window.location.reload();
}
</script>
</ul>
</nav>
</header>
<div class="setsumei">
<br><br><h1 style="text-align: center; font-size: 40px;">◯◯◯◯</h1>
<br><p style="text-align: justify; font-size: 16px;"></p>
<p style="text-align: center; font-size: 13px;">Author: ◯◯◯◯</p>
<p style="text-align: center; font-size: 13px;">Photos/Videos Taken:◯◯◯◯/◯◯/◯◯</p>
<br><br><p style="text-align: justify; font-size: 16px;">
#
</p>
</div>
<br><br><div class="image">
<img src="#" alt="#" width="90%">
<br><br><img src="#" alt="#" width="90%">
<br><br><img src="#" alt="#" width="90%">
<br><br><img src="#" alt="#" width="90%">
<br><br><img src="#" alt="#" width="90%">
<br><br><img src="#" alt="#" width="90%">
<br><br><img src="#" alt="#" width="90%">
<br><br><img src="#" alt="#" width="90%">
<br><br><img src="#" alt="#" width="90%">
<br><br><img src="#" alt="#" width="90%">
</div>
<br><br><footer class="site-footer" style="font-size: 12px;">MORIKOBOSHI© | 日本語</footer>
</div>
</div>
<style>
html {visibility: visible;
opacity: 1;}
.body{background-color: white;
font-family: sans-serif;}
.searchbar{float: right;}
.image{text-align: center;}
.setsumei{margin-left: 20px;
margin-right: 20px;}
.footer{width: 100%;
height: 40px;
text-align: center;
border-top: 1px solid black;
position: absolute;
bottom: 0;
padding: 10px;}
.page-wrap {
min-height: 100%;
/* equal to footer height */
margin-bottom: -40px;
}
.page-wrap:after {
content: "";
display: block;
}
.site-footer, .page-wrap:after {
/* .push must be the same height as footer */
height: 20px;
}
.site-footer {
text-align: center;
border-top: 1px solid black;
padding: 10px;
}
*, *:before, *:after {
padding-left: 0;
margin: 0;
box-sizing: border-box;
}
ol, ul {
list-style: none;
}
a {
text-decoration: none;
color: black;
}
.cp_cont {
height: auto;
}
/* menu */
.cp_offcm03 {
position: relative;
z-index: 5000;
top: 0;
left: 0;
right: 0;
bottom: 0;
overflow: auto;
width: 100%;
height: auto;
padding-top: 0;
-webkit-transition: transform 0.3s ease-in;
transition: transform 0.3s ease-in;
text-align: center;
color: black;
background-color: white;
}
.cp_offcm03 nav,
.cp_offcm03 ul {
height: 100%;
}
.cp_offcm03 li {
display: inline-block;
margin-right: -6px;
}
.cp_offcm03 a {
display: block;
padding: 15px 45px;
margin-bottom: -5px;
-webkit-transition: background-color .3s ease-in;
transition: background-color .3s ease-in;
}
.cp_offcm03 a:hover {
background-color: lightgray;
}
/* menu toggle */
#cp_toggle03 {
display: none;
}
#cp_toggle03:checked ~ .cp_offcm03 {
-webkit-transform: translateX(0);
transform: translateX(0);
}
#cp_toggle03:checked ~ .cp_container {
-webkit-transform: translateX(0);
transform: translateX(0);
}
.cp_mobilebar {
display: none;
}
/* content */
.cp_container {
position: relative;
top: 0;
padding: 35px auto;
-webkit-transition: transform .3s ease-in;
transition: transform .3s ease-in;
}
.cp_content {
margin: 0 auto;
padding: 20px;
height: 65vh;
text-align: center;
}
#media (max-width: 1130px)and (min-width: 280px) {
/* menu */
.cp_offcm03 {
position: fixed;
left: -250px;
overflow-y: hidden;
width: 250px;
height: 100%;
padding-top: 40px;
color: black;
background-color: white;
z-index: 1000;
}
.cp_offcm03 nav {
background: white;
border-right: 0.5px solid lightgray;
margin-left: -210px;
}
.cp_offcm03 li {
display: block;
margin-right: 0;}
.cp_offcm03 a {
padding: 20px;
}
/* menu toggle */
.cp_mobilebar {
display: block;
z-index: 2000;
position: relative;
top: 0;
left: 0;
padding: 0 25px;
width: 100%;
height: 40px;
background-color: white;
border-bottom: .05px solid lightgray;
}
.cp_menuicon {
display: block;
position: relative;
width: 25px;
height: 100%;
cursor: pointer;
-webkit-transition: transform .3s ease-in;
transition: transform .3s ease-in;
}
.cp_menuicon > span {
display: block;
position: absolute;
top: 55%;
margin-top: -0.3em;
width: 100%;
height: 0.2em;
border-radius: 1px;
background-color: black;
-webkit-transition: transform .3s ease;
transition: transform .3s ease;
}
.cp_menuicon > span:before,
.cp_menuicon > span:after {
content: "";
position: absolute;
width: 100%;
height: 100%;
border-radius: 1px;
background-color: black;
-webkit-transition: transform .3s ease-in;
transition: transform .3s ease-in;
}
.cp_menuicon > span:before {
-webkit-transform: translateY(-0.6em);
transform: translateY(-0.6em);
}
.cp_menuicon > span:after {
-webkit-transform: translateY(0.6em);
transform: translateY(0.6em);
}
#cp_toggle03:checked + .cp_mobilebar .cp_menuicon {
-webkit-transform: rotate(45deg);
transform: rotate(45deg);
}
#cp_toggle03:checked + .cp_mobilebar span:before,
#cp_toggle03:checked + .cp_mobilebar span:after {
-webkit-transform: rotate(90deg);
transform: rotate(90deg);
}
#cp_toggle03:checked ~ .cp_offcm03 {
-webkit-transform: translateX(100%);
transform: translateX(100%);
}
#cp_toggle03:checked ~ .cp_container {
-webkit-transform: translateX(250px);
transform: translateX(250px);
}
input:checked ~ #h-menu_black {
display: block;/*カバーを表示*/
opacity: .6;
}
#h-menu_black {
display: none;
position: fixed;
z-index: 999;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: black;
opacity: 0;
transition: .7s ease-in-out;
}
/* content */
.cp_container {
top: 60px;
height: 92vh;
text-align: center;
}
.noscroll{
overflow: hidden;
position: fixed;
}
</style>
</body>
</html>
I would like to thank everyone for their help in trying to solve this issue.
After deleting bits of CSS to see how my website runs without it I found the solution. It was the html { visibility: hidden; opacity: 0; } line of code that was preventing my website from running smoothly on the mobile version of Google Chrome. Getting rid of this line of code stopped my website from freezing.
I'm a beginner in HTML, CSS, and Javascript and am currently in the process of getting a website that I built online. I'm testing it in all browsers to make sure that it works without any issues, but am noticing some issues when on a mobile browser. Specifically, I'm noticing that my website freezes and becomes unusable after viewing a few pages when trying to use it in the mobile version of Google Chrome.
Below is the code that I'm using and if I'm not mistaken I'm sure that there is a line of code inside my CSS that is making Google Chrome freeze on a mobile device. Can anyone see any line of code that should be taken out or replaced? Are there too many scripts for Google Chrome to handle on a mobile device? If anyone has any knowledge about what could possibly be causing this issue I'd really appreciate you sharing it with me.
<!DOCTYPE html>
<html lang="ja">
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0;" charset="utf-8">
<title>MORIKOBOSHI・</title>
</head>
<body>
<div class="page-wrap">
<div class="cp_cont">
<input id="cp_toggle03" type="checkbox"/>
<div class="cp_mobilebar">
<label for="cp_toggle03" class="cp_menuicon">
<span></span>
</label>
</div>
<label id="h-menu_black" class="cp_toggle03" for="cp_menuicon"></label>
<div id="body" class="noscroll"></div>
<header class="cp_offcm03">
<nav>
<ul style="text-align: center; margin-left: 210px; overflow: hidden; padding-bottom: 10px;">
<li style="border-bottom: .05px solid lightgray;">ホーム</li>
<li style="border-bottom: .05px solid lightgray;">ブログ</li>
<li style="border-bottom: .05px solid lightgray;">このサイトについて</li>
<li style="border-bottom: .05px solid lightgray;">参考文献</li>
<div class="searchbar">
<form id="frmSearch" class="search2" method="get" action="default.html" style=" padding-right: 10px; padding-top: 20px; text-align: center; position: inline;">
<input class="search2" id="txtSearch" type="text" placeholder="Googleカスタム検索" name="serach_bar" size="31" maxlength="255" value="" style="top: 185px; width: 180px; height: 26px;">
<input class="search1" type="submit" name="submition" value="検索" style="padding-left: 5px; top: 153px; height: 25px; width: 34px; display: inline-flex; justify-content: center;">
<input class="search2" type="hidden" name="sitesearch" value="default.html">
</form>
</div>
<script type="text/javascript">
document.getElementById('frmSearch').onsubmit = function() {
window.location = 'http://www.google.com/search?q=site:morikoboshi.com' + document.getElementById('txtSearch').value;
return false;
}
</script>
<script>
document.getElementById('cp_toggle03').onchange = function() {
if (document.getElementById('cp_toggle03').checked) {
document.body.style.overflow = "hidden";
} else {
document.body.style.overflow = "";
}
}
</script>
</ul>
</nav>
</header>
<div class="setsumei">
<br><h1 style="text-align: center; font-size: 40px;">◯◯◯◯</h1>
<br><p style="text-align: justify; font-size: 16px;"></p>
<p style="text-align: center; font-size: 13px;">著者:◯◯◯◯</p>
<p style="text-align: center; font-size: 13px;">撮影日:◯◯◯◯年◯◯月◯◯日</p>
<br><br><p style="text-align: justify; font-size: 16px;">
#
</p>
</div>
<br><br><div class="image">
<img src="#" alt="#" width="90%">
<br><br><img src="#" alt="#" width="90%">
<br><br><img src="#" alt="#" width="90%">
<br><br><img src="#" alt="#" width="90%">
<br><br><img src="#" alt="#" width="90%">
<br><br><img src="#" alt="#" width="90%">
<br><br><img src="#" alt="#" width="90%">
<br><br><img src="#" alt="#" width="90%">
<br><br><img src="#" alt="#" width="90%">
<br><br><img src="#" alt="#" width="90%">
</div>
</div>
<br><br><footer class="site-footer" style="font-size: 12px;">MORIKOBOSHI© | English</footer>
</div>
<style>
html {visibility: visible;
opacity: 1;}
.body{background-color: white;
font-family: sans-serif;}
.searchbar{float: right;}
.image{text-align: center;}
.setsumei{margin-left: 20px;
margin-right: 20px;}
.footer{width: 100%;
height: 40px;
text-align: center;
border-top: 1px solid black;
position: absolute;
bottom: 0;
padding: 10px;}
.page-wrap {
min-height: 100%;
/* equal to footer height */
margin-bottom: -40px;
}
.page-wrap:after {
content: "";
display: block;
}
.site-footer, .page-wrap:after {
/* .push must be the same height as footer */
height: 20px;
}
.site-footer {
text-align: center;
border-top: 1px solid black;
padding: 10px;
}
*, *:before, *:after {
padding-left: 0;
margin: 0;
box-sizing: border-box;
}
ol, ul {
list-style: none;
}
a {
text-decoration: none;
color: black;
}
.cp_cont {
height: auto;
}
/* menu */
.cp_offcm03 {
position: relative;
z-index: 5000;
top: 0;
left: 0;
right: 0;
bottom: 0;
overflow: auto;
width: 100%;
height: auto;
padding-top: 0;
-webkit-transition: transform 0.3s ease-in;
transition: transform 0.3s ease-in;
text-align: center;
color: black;
background-color: white;
}
.cp_offcm03 nav,
.cp_offcm03 ul {
height: 100%;
}
.cp_offcm03 li {
display: inline-block;
margin-right: -6px;
}
.cp_offcm03 a {
display: block;
padding: 15px 45px;
margin-bottom: -5px;
-webkit-transition: background-color .3s ease-in;
transition: background-color .3s ease-in;
}
.cp_offcm03 a:hover {
background-color: lightgray;
}
/* menu toggle */
#cp_toggle03 {
display: none;
}
#cp_toggle03:checked ~ .cp_offcm03 {
-webkit-transform: translateX(0);
transform: translateX(0);
}
#cp_toggle03:checked ~ .cp_container {
-webkit-transform: translateX(0);
transform: translateX(0);
}
.cp_mobilebar {
display: none;
}
/* content */
.cp_container {
position: relative;
top: 0;
padding: 35px auto;
-webkit-transition: transform .3s ease-in;
transition: transform .3s ease-in;
}
.cp_content {
margin: 0 auto;
padding: 20px;
height: 65vh;
text-align: center;
}
#media (max-width: 1130px)and (min-width: 280px) {
/* menu */
.cp_offcm03 {
position: fixed;
left: -250px;
overflow-y: hidden;
width: 250px;
height: 100%;
padding-top: 40px;
color: black;
background-color: white;
z-index: 1000;
}
.cp_offcm03 nav {
background: white;
border-right: 0.5px solid lightgray;
margin-left: -210px;
}
.cp_offcm03 li {
display: block;
margin-right: 0;}
.cp_offcm03 a {
padding: 20px;
}
/* menu toggle */
.cp_mobilebar {
display: block;
z-index: 2000;
position: relative;
top: 0;
left: 0;
padding: 0 25px;
width: 100%;
height: 40px;
background-color: white;
border-bottom: .05px solid lightgray;
}
.cp_menuicon {
display: block;
position: relative;
width: 25px;
height: 100%;
cursor: pointer;
-webkit-transition: transform .3s ease-in;
transition: transform .3s ease-in;
}
.cp_menuicon > span {
display: block;
position: absolute;
top: 55%;
margin-top: -0.3em;
width: 100%;
height: 0.2em;
border-radius: 1px;
background-color: black;
-webkit-transition: transform .3s ease;
transition: transform .3s ease;
}
.cp_menuicon > span:before,
.cp_menuicon > span:after {
content: "";
position: absolute;
width: 100%;
height: 100%;
border-radius: 1px;
background-color: black;
-webkit-transition: transform .3s ease-in;
transition: transform .3s ease-in;
}
.cp_menuicon > span:before {
-webkit-transform: translateY(-0.6em);
transform: translateY(-0.6em);
}
.cp_menuicon > span:after {
-webkit-transform: translateY(0.6em);
transform: translateY(0.6em);
}
#cp_toggle03:checked + .cp_mobilebar .cp_menuicon {
-webkit-transform: rotate(45deg);
transform: rotate(45deg);
}
#cp_toggle03:checked + .cp_mobilebar span:before,
#cp_toggle03:checked + .cp_mobilebar span:after {
-webkit-transform: rotate(90deg);
transform: rotate(90deg);
}
#cp_toggle03:checked ~ .cp_offcm03 {
-webkit-transform: translateX(100%);
transform: translateX(100%);
}
#cp_toggle03:checked ~ .cp_container {
-webkit-transform: translateX(250px);
transform: translateX(250px);
}
input:checked ~ #h-menu_black {
display: block;/*カバーを表示*/
opacity: .6;
}
#h-menu_black {
display: none;
position: fixed;
z-index: 999;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: black;
opacity: 0;
transition: .7s ease-in-out;
}
/* content */
.cp_container {
top: 60px;
height: 92vh;
text-align: center;
}
.noscroll{
overflow: hidden;
position: fixed;
}
</style>
</body>
</html>
When I focus/unfocus on password, no shaking happens, but when I focus/unfocus on username then the password shakes...
Why is that happening & how to stop that?
body {
background-color: royalblue; /*#f0f0f0;*/
}
label {
font-family: 'Montserrat', sans-serif;
font-size: 14px;
z-index: -1;
border: 0;
color: white;
position: relative;
}
.head {
color: white;
margin-left: 44%;
font-family: monospace;
font-size: 25px;
}
/*.content {
margin-top: 10%;
margin-left: 41%;
}*/
.password {
margin-top: 5%;
}
form {
position: relative;
}
input {
position: absolute;
font-family: 'Montserrat', sans-serif;
font-size: 15px;
background: transparent;
border: 0; /* BORDER yes/no */
border-bottom: 2px solid beige;
background: transparent;
outline: 0;
height: 25px;
width: 180px;
z-index: 1;
margin-top: 5px;
}
/*input:focus {
outline: 1;
}*/
label::after {
content: '';
position: absolute;
top: 1px;
left: 0;
width: 180px;
height: 25px;
border-radius: 2px;
transition: transform .3s;
}
label::after{
z-index: -1;
background: beige; /*#a86bf;*/
transform: scale3d(1, 0, 1);
transform-origin: 0% 0%;
}
input:focus {
border-radius: 2px;
}
input:focus + label::after,
input:valid + label::after {
transform: scale3d(1, -1.3, 1);
transition-timing-function: linear;
top: -1px;
}
span {
position: relative;
margin-top: -30px;
display: block;
padding: .6em 0;
padding-left: -5px;
transition: top .5s ease, font-size .5s ease;
/* transition: transform 1s 2s;*/
top: 0;
}
input:focus + label > span,
input:valid + label > span {
top: -20px;
font-size: 11px;
padding-bottom: 15px;
}
/* font-family: monospace;*/
/*transform: translate3d(0, -80%, 0); */
/* transition-timing-function: linear;*/
<p class="head">Sign In</p>
<form>
<div class="content">
<div class="username">
<input name="name" class="user-input" id="user" required>
<label class="user-label" for="user"><span>Username</span></label>
</div>
<div class="password">
<input name="name" class="pass-input" id="pass" required>
<label class="pass-label" for="pass"><span>Password</span></label>
</div>
</div>
</form>
Add height to both div containers, so they keep it when clicked on.
body {
background-color: royalblue; /*#f0f0f0;*/
}
label {
font-family: 'Montserrat', sans-serif;
font-size: 14px;
z-index: -1;
border: 0;
color: white;
position: relative;
}
.head {
color: white;
margin-left: 44%;
font-family: monospace;
font-size: 25px;
}
.username {
height:40px;
}
.password {
height:40px;
}
/*.content {
margin-top: 10%;
margin-left: 41%;
}*/
.password {
margin-top: 5%;
}
form {
position: relative;
}
input {
position: absolute;
font-family: 'Montserrat', sans-serif;
font-size: 15px;
background: transparent;
border: 0; /* BORDER yes/no */
border-bottom: 2px solid beige;
background: transparent;
outline: 0;
height: 25px;
width: 180px;
z-index: 1;
margin-top: 5px;
}
/*input:focus {
outline: 1;
}*/
label::after {
content: '';
position: absolute;
top: 1px;
left: 0;
width: 180px;
height: 25px;
border-radius: 2px;
transition: transform .3s;
}
label::after{
z-index: -1;
background: beige; /*#a86bf;*/
transform: scale3d(1, 0, 1);
transform-origin: 0% 0%;
}
input:focus {
border-radius: 2px;
}
input:focus + label::after,
input:valid + label::after {
transform: scale3d(1, -1.3, 1);
transition-timing-function: linear;
top: -1px;
}
span {
position: relative;
margin-top: -30px;
display: block;
padding: .6em 0;
padding-left: -5px;
transition: top .5s ease, font-size .5s ease;
/* transition: transform 1s 2s;*/
top: 0;
}
input:focus + label > span,
input:valid + label > span {
top: -20px;
font-size: 11px;
padding-bottom: 15px;
}
/* font-family: monospace;*/
/*transform: translate3d(0, -80%, 0); */
/* transition-timing-function: linear;*/
<p class="head">Sign In</p>
<form>
<div class="content">
<div class="username" >
<input name="name" class="user-input" id="user" required>
<label class="user-label" for="user"><span>Username</span></label>
</div>
<div class="password" >
<input name="name" class="pass-input" id="pass" required>
<label class="pass-label" for="pass"><span>Password</span></label>
</div>
</div>
</form>
What I think's happening is that your CSS is adding a small margin to the bottom of the <div class="username"> and this is causing your "shaking". The reason it's not happening when you click on the Password is because there's nothing under it.
How do I get the animation to occur on :check of radio button instead of :focus?
I tried .radio-button:checked ~ .item-tile and input[type=radio]:checked + .item-tile both not working.
.item .radio-button:focus+.item-tile {
border: 2px solid #079ad9;
-webkit-transform: scale(1.1, 1.1);
-ms-transform: scale(1.1, 1.1);
transform: scale(1.1, 1.1);
}
.item-wrap {
display: flex;
}
.item-tile {
display: -webkit-box;
display: -ms-flexbox;
display: flex;
margin: 15px;
background: white;
-webkit-box-align: center;
-ms-flex-align: center;
align-items: center;
height: 50px;
border-radius: 10px;
}
.item-tile label {
border: 1px solid;
flex: 0;
padding: 0px 10px 0px 5px;
}
.icon {
margin: 0px 5px 0px 5px;
position: relative;
height: 35px;
width: 35px;
border-radius: 50%;
}
.item {
position: relative;
}
.item .radio-button {
opacity: 0;
position: absolute;
top: 0;
left: 0;
bottom: 0;
left: 0;
height: 100%;
width: 100%;
margin: 0;
z-index: 999;
cursor: pointer;
}
.item .item-tile {
-webkit-transition: -webkit-transform 300ms ease;
transition: -webkit-transform 300ms ease;
-o-transition: transform 300ms ease;
transition: transform 300ms ease;
transition: transform 300ms ease, -webkit-transform 300ms ease;
}
<div class="container">
<div class="item-wrap">
<div class="item">
<input id="blue" class="radio-button" type="radio" name="radio" />
<div class="item-tile">
<div class="icon" style="background-color:blue;">
</div>
<label for="blue" class="item-tile-label"><text class="item-text">Blue</text></label>
</div>
</div>
<div class="item">
<input id="elephant" class="radio-button" type="radio" name="radio" />
<div class="item-tile">
<div class="icon" style="background-color:red;">
</div>
<label for="elephant" class="item-tile-label"><text class="item-text">Elephant</text></label>
</div>
</div>
</div>
You'd be looking for .item .radio-button:checked + .item-tile:
.item .radio-button:checked + .item-tile {
border: 2px solid #079ad9;
-webkit-transform: scale(1.1, 1.1);
-ms-transform: scale(1.1, 1.1);
transform: scale(1.1, 1.1);
}
.item-wrap {
display: flex;
}
.item-tile {
display: -webkit-box;
display: -ms-flexbox;
display: flex;
margin: 15px;
background: white;
-webkit-box-align: center;
-ms-flex-align: center;
align-items: center;
height: 50px;
border-radius: 10px;
}
.item-tile label {
border: 1px solid;
flex: 0;
padding: 0px 10px 0px 5px;
}
.icon {
margin: 0px 5px 0px 5px;
position: relative;
height: 35px;
width: 35px;
border-radius: 50%;
}
.item {
position: relative;
}
.item .radio-button {
opacity: 0;
position: absolute;
top: 0;
left: 0;
bottom: 0;
left: 0;
height: 100%;
width: 100%;
margin: 0;
z-index: 999;
cursor: pointer;
}
.item .item-tile {
-webkit-transition: -webkit-transform 300ms ease;
transition: -webkit-transform 300ms ease;
-o-transition: transform 300ms ease;
transition: transform 300ms ease;
transition: transform 300ms ease, -webkit-transform 300ms ease;
}
<div class="container">
<div class="item-wrap">
<div class="item">
<input id="blue" class="radio-button" type="radio" name="radio" />
<div class="item-tile">
<div class="icon" style="background-color:blue;">
</div>
<label for="blue" class="item-tile-label"><text class="item-text">Blue</text></label>
</div>
</div>
<div class="item">
<input id="elephant" class="radio-button" type="radio" name="radio" />
<div class="item-tile">
<div class="icon" style="background-color:red;">
</div>
<label for="elephant" class="item-tile-label"><text class="item-text">Elephant</text></label>
</div>
</div>
</div>
How to do placeholder styling when Input Text are focus, the placeholder are still visible and the font-size become smaller. For example like this:
I only need webkit support. Does webkit support such thing?
.input {
width: 200px;
height: 35px;
outline:0;
padding:0 10px;
}
.label { position: absolute;
pointer-events: none;
left: 20px;
top: 18px;
transition: 0.2s ease all;
}
input:focus ~ .label,
input:not(:focus):valid ~ .label{
top: 10px;
bottom: 5px;
left: 20px;
font-size: 12px;
}
<div>
<input type="text" class="input" required/>
<span class="label">Company Name</span>
</div>
You need to use a label element and modify it accordingly. Try this:
function fillClass() {
if ($(this).val() != '')
$(this).parent().addClass('input--filled');
else
$(this).parent().removeClass('input--filled');
}
$(".sign-in-input").focusout(fillClass);
.sign-in-input-ctr {
width: 100%;
display: inline-block;
vertical-align: top;
margin-bottom: 25px;
position: relative;
margin-top: 50px;
}
.sign-in-input {
width: 100%;
border: 2px solid transparent;
-webkit-transition: all 0.3s;
transition: all 0.3s;
height: 38px;
background-color: #fff;
outline: none;
border: 1px solid rgba(73, 73, 73, 0.2);
border-radius: 2px;
padding-left: 10px;
}
.sign-in-input:focus,
.input--filled .sign-in-input {
background-color: transparent;
border: 1px solid #a09e9e;
}
.sign-in-label {
width: 100%;
font-size: 12px;
position: absolute;
top: -18px;
pointer-events: none;
overflow: hidden;
padding: 0 15px;
left: 0;
-webkit-transform: translate3d(0, 30px, 0);
transform: translate3d(0, 30px, 0);
-webkit-transition: -webkit-transform 0.3s;
transition: transform 0.3s;
}
.sign-in-input:focus+.sign-in-label,
.input--filled .sign-in-label {
-webkit-transform: translate3d(-15px, 0, 0);
transform: translate3d(-15px, 0, 0);
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div class="sign-in-input-ctr">
<input class="sign-in-input" type="text" name="email">
<label class="sign-in-label" for="signin-email"><span class="input-label-content">Email</span>
</label>
</div>
//------ contact us dropdown list
$(document).ready(function(){
$( ".form-group .form-control" ).focus(function() {
$(this).parent().addClass('inputFous');
}).blur(function() {
if($.trim($(this).val()) == '')
{
$(this).parent().removeClass('inputFous');
}
});
});
I think there is no webkit support for this, please check this code which will help you:- Jsfiddle