質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.48%
HTML5

HTML5 (Hyper Text Markup Language、バージョン 5)は、マークアップ言語であるHTMLの第5版です。

JavaScript

JavaScriptは、プログラミング言語のひとつです。ネットスケープコミュニケーションズで開発されました。 開発当初はLiveScriptと呼ばれていましたが、業務提携していたサン・マイクロシステムズが開発したJavaが脚光を浴びていたことから、JavaScriptと改名されました。 動きのあるWebページを作ることを目的に開発されたもので、主要なWebブラウザのほとんどに搭載されています。

CSS

CSSはXMLやHTMLで表現した色・レイアウト・フォントなどの要素を指示する仕様の1つです。

React.js

Reactは、アプリケーションのインターフェースを構築するためのオープンソースJavaScriptライブラリです。

Q&A

0回答

607閲覧

cssのtransformについて

DaichiYasuda

総合スコア173

HTML5

HTML5 (Hyper Text Markup Language、バージョン 5)は、マークアップ言語であるHTMLの第5版です。

JavaScript

JavaScriptは、プログラミング言語のひとつです。ネットスケープコミュニケーションズで開発されました。 開発当初はLiveScriptと呼ばれていましたが、業務提携していたサン・マイクロシステムズが開発したJavaが脚光を浴びていたことから、JavaScriptと改名されました。 動きのあるWebページを作ることを目的に開発されたもので、主要なWebブラウザのほとんどに搭載されています。

CSS

CSSはXMLやHTMLで表現した色・レイアウト・フォントなどの要素を指示する仕様の1つです。

React.js

Reactは、アプリケーションのインターフェースを構築するためのオープンソースJavaScriptライブラリです。

0グッド

0クリップ

投稿2019/07/20 17:14

取り組んでいること

SignUpとSignInのコードを書いています

環境

"react": "^16.8.6",

現在のコード

javascript

1//App.js 2import Reactfrom 'react' 3import Signin from './Signin' 4 5library.add(fab, faGoogle, faCoffee) 6 7const App = () => { 8 const [state, dispatch] = useReducer(reducer, []) 9 10 return ( 11 <React.Fragment> 12 <Signin /> 13 </React.Fragment> 14 ) 15} 16 17export default App

javascript

1//Signin.js 2import React, { useState } from 'react' 3import './index.css' 4 5const Signin = () => { 6 const [hidden, setHidden] = useState(true) 7 8 return ( 9 <div className="container" id="container"> 10 <div className="form-container sign-in-container" id="signinScreen"> 11 <form action="#"> 12 <h1>Sign in</h1> 13 <div className="social-container"> 14 <a href="#" class="social"> 15 <i className="fab fa-facebook-f"></i> 16 </a> 17 <a href="#" class="social"> 18 <i className="fab fa-google-plus-g"></i> 19 </a> 20 <a href="#" class="social"> 21 <i className="fab fa-linkedin-in"></i> 22 </a> 23 </div> 24 <span>or use your account</span> 25 <input type="email" placeholder="Email" /> 26 <input type="password" placeholder="Password" /> 27 <a href="#">Forgot your password?</a> 28 <button>Sign In</button> 29 </form> 30 </div> 31 <div className="form-container sign-up-container" id="signupScreen"> 32 <form action="#"> 33 <h1>Create Account</h1> 34 <div className="social-container"> 35 <a href="#" className="social"> 36 <i className="fab fa-facebook-f"></i> 37 </a> 38 <a href="#" class="social"> 39 <i className="fab fa-google-plus-g"></i> 40 </a> 41 <a href="#" class="social"> 42 <i className="fab fa-linkedin-in"></i> 43 </a> 44 </div> 45 <span>or use your email for registration</span> 46 <input type="text" placeholder="Name" /> 47 <input type="email" placeholder="Email" /> 48 <input type="password" placeholder="Password" /> 49 <button>Sign Up</button> 50 </form> 51 </div> 52 <div className="overlay-container"> 53 <div className="overlay"> 54 <div className="overlay-panel overlay-left"> 55 <h1>Welcome Back!</h1> 56 <p> 57 To keep connected with us please login with your personal info 58 </p> 59 <button className="ghost" id="signIn"> 60 Sign In 61 </button> 62 </div> 63 <div className="overlay-panel overlay-right"> 64 <h1>Hello, Friend!</h1> 65 <p>Enter your personal details and start journey with us</p> 66 <button className="ghost" id="signUp" onClick={toSignInScreen}> 67 Sign Up 68 </button> 69 </div> 70 </div> 71 </div> 72 </div> 73 ) 74} 75 76export default Signin

css

1@import url('https://fonts.googleapis.com/css?family=Montserrat:400,800'); 2 3* { 4 box-sizing: border-box; 5} 6 7body { 8 background: #f6f5f7; 9 display: flex; 10 justify-content: center; 11 align-items: center; 12 flex-direction: column; 13 font-family: 'Montserrat', sans-serif; 14 height: 100vh; 15 margin: -20px 0 50px; 16} 17 18h1 { 19 font-weight: bold; 20 margin: 0; 21} 22 23h2 { 24 text-align: center; 25} 26 27p { 28 font-size: 14px; 29 font-weight: 100; 30 line-height: 20px; 31 letter-spacing: 0.5px; 32 margin: 20px 0 30px; 33} 34 35span { 36 font-size: 12px; 37} 38 39a { 40 color: #333; 41 font-size: 14px; 42 text-decoration: none; 43 margin: 15px 0; 44} 45 46button { 47 border-radius: 20px; 48 border: 1px solid #ff4b2b; 49 background-color: #ff4b2b; 50 color: #ffffff; 51 font-size: 12px; 52 font-weight: bold; 53 padding: 12px 45px; 54 letter-spacing: 1px; 55 text-transform: uppercase; 56 transition: transform 80ms ease-in; 57} 58 59button:active { 60 transform: scale(0.95); 61} 62 63button:focus { 64 outline: none; 65} 66 67button.ghost { 68 background-color: transparent; 69 border-color: #ffffff; 70} 71 72form { 73 background-color: #ffffff; 74 display: flex; 75 align-items: center; 76 justify-content: center; 77 flex-direction: column; 78 padding: 0 50px; 79 height: 100%; 80 text-align: center; 81} 82 83input { 84 background-color: #eee; 85 border: none; 86 padding: 12px 15px; 87 margin: 8px 0; 88 width: 100%; 89} 90 91.container { 92 background-color: #fff; 93 border-radius: 10px; 94 box-shadow: 0 14px 28px rgba(0, 0, 0, 0.25), 0 10px 10px rgba(0, 0, 0, 0.22); 95 position: relative; 96 overflow: hidden; 97 /* width: 768px; */ 98 max-width: 100%; 99 min-height: 480px; 100} 101 102.form-container { 103 position: absolute; 104 top: 0; 105 height: 100%; 106 transition: all 0.6s ease-in-out; 107} 108 109.sign-in-container { 110 left: 0; 111 width: 50%; 112 z-index: 2; 113} 114 115.container.right-panel-active .sign-in-container { 116 transform: translateX(100%); 117} 118 119.sign-up-container { 120 left: 0; 121 width: 50%; 122 opacity: 0; 123 z-index: 1; 124} 125 126.container.right-panel-active .sign-up-container { 127 transform: translateX(100%); 128 opacity: 1; 129 z-index: 5; 130 animation: show 0.6s; 131} 132 133@keyframes show { 134 0%, 135 49.99% { 136 opacity: 0; 137 z-index: 1; 138 } 139 140 50%, 141 100% { 142 opacity: 1; 143 z-index: 5; 144 } 145} 146 147.overlay-container { 148 position: absolute; 149 top: 0; 150 left: 50%; 151 width: 50%; 152 height: 100%; 153 overflow: hidden; 154 transition: transform 0.6s ease-in-out; 155 z-index: 100; 156} 157 158.container.right-panel-active .overlay-container { 159 transform: translateX(-100%); 160} 161 162.overlay { 163 background: #ff416c; 164 background: -webkit-linear-gradient(to right, #ff4b2b, #ff416c); 165 background: linear-gradient(to right, #ff4b2b, #ff416c); 166 background-repeat: no-repeat; 167 background-size: cover; 168 background-position: 0 0; 169 color: #ffffff; 170 position: relative; 171 left: -100%; 172 height: 100%; 173 width: 200%; 174 transform: translateX(0); 175 transition: transform 0.6s ease-in-out; 176} 177 178.container.right-panel-active .overlay { 179 transform: translateX(50%); 180} 181 182.overlay-panel { 183 position: absolute; 184 display: flex; 185 align-items: center; 186 justify-content: center; 187 flex-direction: column; 188 padding: 0 40px; 189 text-align: center; 190 top: 0; 191 height: 100%; 192 width: 50%; 193 transform: translateX(0); 194 transition: transform 0.6s ease-in-out; 195} 196 197.overlay-left { 198 transform: translateX(-20%); 199} 200 201.container.right-panel-active .overlay-left { 202 transform: translateX(0); 203} 204 205.overlay-right { 206 right: 0; 207 transform: translateX(0); 208} 209 210.container.right-panel-active .overlay-right { 211 transform: translateX(20%); 212} 213 214.social-container { 215 margin: 20px 0; 216} 217 218.social-container a { 219 border: 1px solid #dddddd; 220 border-radius: 50%; 221 display: inline-flex; 222 justify-content: center; 223 align-items: center; 224 margin: 0 5px; 225 height: 40px; 226 width: 40px; 227} 228 229footer { 230 background-color: #222; 231 color: #fff; 232 font-size: 14px; 233 bottom: 0; 234 position: fixed; 235 left: 0; 236 right: 0; 237 text-align: center; 238 z-index: 999; 239} 240 241footer p { 242 margin: 10px 0; 243} 244 245footer i { 246 color: red; 247} 248 249footer a { 250 color: #3c97bf; 251 text-decoration: none; 252}

実現したいこと

参考リンク
参考リンクのようにSignInボタン,SignUpボタンを押すことで画面の表示を切り替えたい.

問題

SignUpボタンを押すことで,right-panel-activeというcssクラスが追加されます.
SignUpボタンが押されたと仮定して,下記のようにしたところ,表示がかぶってしまいます.

javascript

1<div className="container right-panel-active" id="container">

参考画像

どのようにすれば,画面がきちんと分割されるでしょうか?

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

まだ回答がついていません

会員登録して回答してみよう

アカウントをお持ちの方は

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.48%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問