我正在學(xué)習(xí)前端,我正在嘗試從前端發(fā)起挑戰(zhàn),它還包括一些表單驗證。因此,每當(dāng)用戶提交表單時,如果任何輸入字段為空,輸入中應(yīng)出現(xiàn)一個小錯誤圖像,并且輸入下方還應(yīng)有一行說明輸入字段不應(yīng)為空。因此,當(dāng)出現(xiàn)錯誤時,會出現(xiàn)圖像和線條,但我的表格高度會增加。我給了 body 和封閉的容器一個最小高度,但它仍然不工作..挑戰(zhàn)鏈接 挑戰(zhàn)鏈接代碼筆鏈接代碼筆代碼<!DOCTYPE html><html><head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <!-- displays site properly based on user's device --> <link rel="stylesheet" href="style.css"> <link rel="icon" type="image/png" sizes="32x32" href="./images/favicon-32x32.png"> <title>Frontend Mentor | Intro component with sign up form</title> <!-- Feel free to remove these styles or customise in your own stylesheet ?? --> </head><body> <div class="container"> <div class="left"> <h1> Learn to code by watching others</h1> <p>See how experienced developers solve problems in real-time. Watching scripted tutorials is great, but understanding how developers think is invaluable. </p> </div> <div class="right"> <div class="heading"> <p>Try it free 7 days <span>then $20/mo. thereafter</span></p> </div> <form action="#"> <div> <input type="text" placeholder="First Name"> <img class="error-image" src="images/icon-error.svg" alt=""> <p class="error-text">First Name cannot be empty</p> </div> <div> <input type="text" placeholder="Last Name"> <img class="error-image" src="images/icon-error.svg" alt=""> <p class="error-text">Last Name cannot be empty</p> </div> <div> <input type="text" placeholder="Email Address"> <img class="error-image" src="images/icon-error.svg" alt=""> <p class="error-text">Looks like this is not an email</p> </div> </form> </div> </div> </div> <script src="index.js"></script></body></html>
為什么顯示錯誤后我的表單高度會增加?
幕布斯7119047
2023-04-14 15:16:16