如何使这个表格在框下面?

huangapple go评论89阅读模式
英文:

How Can I Make This Form Under Box?

问题

以下是您要翻译的部分:

"Hello I want to make form under the box (new referral) like in the image below:

如何使这个表格在框下面?

How can I do it? I wanna add first name last name date of birth, phone, email, address sections under the box but I could not solve it out. Any help appreciated.

I shared my codes on code snippet. I wanna add icon and write First name side by side and I want line under first name. Others are like that too."

图像如下:

如何使这个表格在框下面?

英文:

Hello I want to make form under the box (new referral) like in the image below:

如何使这个表格在框下面?

How can I do it? I wanna add first name last name date of birth, phone, email, address sections under the box but I could not solve it out. Any help appreciated.

I shared my codes on code snippet. I wanna add icon and write First name side by side and I want line under first name. Others are like that too.

<!-- begin snippet: js hide: false console: true babel: false -->

<!-- language: lang-css -->

  1. * {
  2. margin: 0;
  3. border: 0;
  4. box-sizing: border-box;
  5. background: #CDE7ED;
  6. }
  7. .heading1 {
  8. position: absolute;
  9. width: 449px;
  10. height: 80px;
  11. top: 56px;
  12. font-family: &#39;Montserrat&#39;;
  13. font-style: normal;
  14. font-weight: 500;
  15. font-size: 30px;
  16. line-height: 40px;
  17. /* or 133% */
  18. text-align: center;
  19. background: #FFFFFF;
  20. color: #0B2B5B;
  21. }
  22. #navbar {
  23. position: relative;
  24. height: 196px;
  25. top: 0px;
  26. display: flex;
  27. justify-content: center;
  28. background: #FFFFFF;
  29. }
  30. .iki {
  31. height: 32px;
  32. left: 539px;
  33. top: 230px;
  34. font-family: &#39;Montserrat&#39;;
  35. font-style: normal;
  36. font-weight: 500;
  37. font-size: 24px;
  38. line-height: 32px;
  39. text-align: center;
  40. color: #0B2B5B;
  41. }
  42. .uc {
  43. height: 32px;
  44. left: 435px;
  45. top: 270px;
  46. font-family: &#39;Montserrat&#39;;
  47. font-style: normal;
  48. font-weight: 500;
  49. font-size: 20px;
  50. line-height: 32px;
  51. /* identical to box height, or 160% */
  52. text-align: center;
  53. color: #0B2B5B;
  54. }
  55. .box {
  56. position: absolute;
  57. width: 782px;
  58. height: 380px;
  59. left: 470px;
  60. top: 334px;
  61. background: #FFFFFF;
  62. box-shadow: 0px 2px 4px rgba(11, 43, 91, 0.1);
  63. border-radius: 4px;
  64. }
  65. .box-header {
  66. width: 782px;
  67. height: 64px;
  68. left: 249px;
  69. top: 334px;
  70. background: #FFFFFF;
  71. border-radius: 4px 4px 0px 0px;
  72. display: flex;
  73. }
  74. .b1 {
  75. width: 40px;
  76. height: 64px;
  77. left: 249px;
  78. top: 334px;
  79. background: #25A575;
  80. border-radius: 4px 0px 0px 0px;
  81. }
  82. .b11 {
  83. width: 10px;
  84. height: 32px;
  85. left: 264px;
  86. top: 350px;
  87. font-family: &#39;Montserrat&#39;;
  88. font-style: normal;
  89. font-weight: 500;
  90. font-size: 26px;
  91. line-height: 32px;
  92. display: flex;
  93. align-items: center;
  94. text-align: center;
  95. font-feature-settings: &#39;pnum&#39; on, &#39;lnum&#39; on;
  96. color: #FFFFFF;
  97. background: #25A575;
  98. }
  99. .new {
  100. position: sticky;
  101. width: 132px;
  102. height: 24px;
  103. left: 305px;
  104. top: 354px;
  105. padding-left: 10px;
  106. font-family: &#39;Montserrat&#39;;
  107. font-style: normal;
  108. font-weight: 500;
  109. font-size: 20px;
  110. line-height: 24px;
  111. /* identical to box height, or 120% */
  112. display: flex;
  113. align-items: center;
  114. font-feature-settings: &#39;pnum&#39; on, &#39;lnum&#39; on;
  115. color: #3A719B;
  116. background-color: white;
  117. }
  118. .box-body {
  119. width: 295px;
  120. height: 16px;
  121. left: 24px;
  122. top: 0px;
  123. font-family: &#39;Montserrat&#39;;
  124. font-style: normal;
  125. font-weight: 400;
  126. font-size: 16px;
  127. line-height: 16px;
  128. /* identical to box height, or 100% */
  129. display: flex;
  130. align-items: center;
  131. color: #3A719B;
  132. }
  133. .line {
  134. position: absolute;
  135. left: 0%;
  136. right: 0%;
  137. top: 100%;
  138. bottom: 0%;
  139. border: 1px solid #3A719B;
  140. }

<!-- language: lang-html -->

  1. &lt;!DOCTYPE html&gt;
  2. &lt;html lang=&quot;en&quot;&gt;
  3. &lt;head&gt;
  4. &lt;meta charset=&quot;UTF-8&quot;&gt;
  5. &lt;meta http-equiv=&quot;X-UA-Compatible&quot; content=&quot;IE=edge&quot;&gt;
  6. &lt;meta name=&quot;viewport&quot; content=&quot;width=device-width, initial-scale=1.0&quot;&gt;
  7. &lt;link rel=&quot;stylesheet&quot; href=&quot;style.css&quot;&gt;
  8. &lt;script src=&quot;https://code.jquery.com/jquery-3.3.1.min.js&quot;&gt;&lt;/script&gt;
  9. &lt;script src=&quot;https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js&quot;&gt;&lt;/script&gt;
  10. &lt;link rel=&quot;stylesheet&quot; href=&quot;https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.2.0/css/all.min.css&quot;&gt;
  11. &lt;link rel=&quot;preconnect&quot; href=&quot;https://fonts.googleapis.com&quot;&gt;
  12. &lt;link rel=&quot;preconnect&quot; href=&quot;https://fonts.gstatic.com&quot; crossorigin&gt;
  13. &lt;link href=&quot;https://fonts.googleapis.com/css2?family=Open+Sans:wght@400;700;800&amp;family=Oswald:wght@200;300;400&amp;display=swap&quot; rel=&quot;stylesheet&quot;&gt;
  14. &lt;link rel=&quot;stylesheet&quot; href=&quot;https://kit.fontawesome.com/0b27183842.css&quot; crossorigin=&quot;anonymous&quot;&gt;
  15. &lt;title&gt;Document&lt;/title&gt;
  16. &lt;/head&gt;
  17. &lt;body&gt;
  18. &lt;script src=&quot;app.js&quot;&gt;&lt;/script&gt;
  19. &lt;header class=&quot;header&quot;&gt;
  20. &lt;div class=&quot;container&quot;&gt;
  21. &lt;nav id=&quot;navbar&quot;&gt;
  22. &lt;h1 class=&quot;heading1&quot;&gt;Patient Referral Form Hayes Valley Health San Francisco &lt;/h1&gt;
  23. &lt;/nav&gt;
  24. &lt;/div&gt;
  25. &lt;/header&gt;
  26. &lt;h2 class=&quot;iki&quot;&gt;Referral Patients&lt;/h2&gt;
  27. &lt;h3 class=&quot;uc&quot;&gt;You can add up to five patients at a time&lt;/h3&gt;
  28. &lt;div class=&quot;box&quot;&gt;
  29. &lt;div class=&quot;box-header&quot;&gt;
  30. &lt;div class=&quot;b1&quot;&gt;
  31. &lt;div class=&quot;b11&quot;&gt;
  32. 1
  33. &lt;/div&gt;
  34. &lt;/div&gt;
  35. &lt;div class=&quot;new&quot;&gt;
  36. New Referral
  37. &lt;/div&gt;
  38. &lt;/div&gt;
  39. &lt;/div&gt;
  40. &lt;/body&gt;
  41. &lt;/html&gt;

<!-- end snippet -->

答案1

得分: -1

尝试使用margin:auto;而不是position:absolute;,像这样:

  1. body {
  2. margin: 0;
  3. background: #CDE7ED;
  4. }
  5. .heading1 {
  6. width: 449px;
  7. height: 80px;
  8. margin: auto; /* 这里改为margin:auto; */
  9. font-family: 'Montserrat';
  10. font-style: normal;
  11. font-weight: 500;
  12. font-size: 30px;
  13. line-height: 40px;
  14. text-align: center;
  15. background: #FFFFFF;
  16. color: #0B2B5B;
  17. }
  18. #navbar {
  19. position: relative;
  20. height: 196px;
  21. top: 0px;
  22. display: flex;
  23. justify-content: center;
  24. background: #FFFFFF;
  25. }
  26. /* 其他样式保持不变 */

请注意,我只对heading1position属性进行了更改,其他样式保持不变。

英文:

Try using the margin:auto; instead of position:absolute; like this:

<!-- begin snippet: js hide: false console: true babel: null -->

<!-- language: lang-css -->

  1. body {
  2. margin: 0;
  3. background: #CDE7ED;
  4. }
  5. .heading1{
  6. position: absolute;
  7. width: 449px;
  8. height: 80px;
  9. top: 56px;
  10. font-family: &#39;Montserrat&#39;;
  11. font-style: normal;
  12. font-weight: 500;
  13. font-size: 30px;
  14. line-height: 40px;
  15. /* or 133% */
  16. text-align: center;
  17. background: #FFFFFF;
  18. color: #0B2B5B;
  19. }
  20. #navbar{
  21. position: relative;
  22. height: 196px;
  23. top: 0px;
  24. display: flex;
  25. justify-content: center;
  26. background: #FFFFFF;
  27. }
  28. .iki{
  29. height: 32px;
  30. margin-top: 20px;
  31. font-family: &#39;Montserrat&#39;;
  32. font-style: normal;
  33. font-weight: 500;
  34. font-size: 24px;
  35. line-height: 32px;
  36. text-align: center;
  37. color: #0B2B5B;
  38. }
  39. .uc{
  40. height: 32px;
  41. margin-bottom: 20px;
  42. font-family: &#39;Montserrat&#39;;
  43. font-style: normal;
  44. font-weight: 500;
  45. font-size: 20px;
  46. line-height: 32px;
  47. /* identical to box height, or 160% */
  48. text-align: center;
  49. color: #0B2B5B;
  50. }
  51. .box{
  52. width: 782px;
  53. height: 380px;
  54. margin: auto;
  55. background: #FFFFFF;
  56. box-shadow: 0px 2px 4px rgba(11, 43, 91, 0.1);
  57. border-radius: 4px;
  58. }
  59. .box-header{
  60. width: 782px;
  61. height: 64px;
  62. left: 249px;
  63. top: 334px;
  64. background: #FFFFFF;
  65. border-radius: 4px 4px 0px 0px;
  66. display: flex;
  67. }
  68. .b1{
  69. width: 40px;
  70. background: #25A575;
  71. }
  72. .b11{
  73. height: 100%;
  74. font-weight: 500;
  75. font-size: 26px;
  76. display: flex;
  77. align-items: center;
  78. justify-content: center;
  79. color: #FFFFFF;
  80. }
  81. .new{
  82. padding-left: 20px;
  83. font-family: &#39;Montserrat&#39;;
  84. font-style: normal;
  85. font-weight: 500;
  86. font-size: 20px;
  87. display: flex;
  88. align-items: center;
  89. font-feature-settings: &#39;pnum&#39; on, &#39;lnum&#39; on;
  90. color: #3A719B;
  91. background-color: white;
  92. }
  93. .box-body{
  94. width: 295px;
  95. height: 16px;
  96. left: 24px;
  97. top: 0px;
  98. font-family: &#39;Montserrat&#39;;
  99. font-style: normal;
  100. font-weight: 400;
  101. font-size: 16px;
  102. line-height: 16px;
  103. /* identical to box height, or 100% */
  104. display: flex;
  105. align-items: center;
  106. color: #3A719B;
  107. }
  108. .line{
  109. position: absolute;
  110. left: 0%;
  111. right: 0%;
  112. top: 100%;
  113. bottom: 0%;
  114. border: 1px solid #3A719B;
  115. }
  116. .disflex {
  117. display: flex;
  118. }
  119. .form_inp {
  120. padding: 60px;
  121. }
  122. .disflex .input-container, .full-input-container {
  123. width: 50%;
  124. border-bottom: 1.5px solid steelblue;
  125. margin: 0 30px 30px 0;
  126. }
  127. .disflex .input-container input, .full-input-container input {
  128. border: 0;
  129. }
  130. .full-input-container {
  131. width: 100% !important;
  132. margin: 0 0 30px 0 !important;
  133. }
  134. .btn {
  135. margin: 0 0 50px 0;
  136. width: 100%;
  137. border-radius: 50px;
  138. padding: 10px;
  139. background-color: midnightblue;
  140. color: white;
  141. }

<!-- language: lang-html -->

  1. &lt;!DOCTYPE html&gt;
  2. &lt;html lang=&quot;en&quot;&gt;
  3. &lt;head&gt;
  4. &lt;meta charset=&quot;UTF-8&quot;&gt;
  5. &lt;meta http-equiv=&quot;X-UA-Compatible&quot; content=&quot;IE=edge&quot;&gt;
  6. &lt;meta name=&quot;viewport&quot; content=&quot;width=device-width, initial-scale=1.0&quot;&gt;
  7. &lt;link rel=&quot;stylesheet&quot; href=&quot;style.css&quot;&gt;
  8. &lt;script src=&quot;https://use.fontawesome.com/your-embed-code.js&quot;&gt;&lt;/script&gt; &lt;!-- TODO: Place your Font Awesome embed code --&gt;
  9. &lt;script src=&quot;https://code.jquery.com/jquery-3.3.1.min.js&quot;&gt;&lt;/script&gt;
  10. &lt;script src=&quot;https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js&quot;&gt;&lt;/script&gt;
  11. &lt;link rel=&quot;stylesheet&quot; href=&quot;https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.2.0/css/all.min.css&quot;&gt;
  12. &lt;link rel=&quot;preconnect&quot; href=&quot;https://fonts.googleapis.com&quot;&gt;
  13. &lt;link rel=&quot;preconnect&quot; href=&quot;https://fonts.gstatic.com&quot; crossorigin&gt;
  14. &lt;link href=&quot;https://fonts.googleapis.com/css2?family=Open+Sans:wght@400;700;800&amp;family=Oswald:wght@200;300;400&amp;display=swap&quot; rel=&quot;stylesheet&quot;&gt;
  15. &lt;link rel=&quot;stylesheet&quot; href=&quot;https://kit.fontawesome.com/0b27183842.css&quot; crossorigin=&quot;anonymous&quot;&gt;
  16. &lt;title&gt;Document&lt;/title&gt;
  17. &lt;/head&gt;
  18. &lt;body&gt;
  19. &lt;script src=&quot;app.js&quot;&gt;&lt;/script&gt;
  20. &lt;header class=&quot;header&quot;&gt;
  21. &lt;div class=&quot;container&quot;&gt;
  22. &lt;nav id=&quot;navbar&quot;&gt;
  23. &lt;h1 class=&quot;heading1&quot;&gt;Patient Referral Form Hayes Valley Health San Francisco &lt;/h1&gt;
  24. &lt;/nav&gt;
  25. &lt;/div&gt;
  26. &lt;/header&gt;
  27. &lt;h2 class=&quot;iki&quot;&gt;Referral Patients&lt;/h2&gt;
  28. &lt;h3 class=&quot;uc&quot;&gt;You can add up to five patients at a time&lt;/h3&gt;
  29. &lt;div class=&quot;box&quot;&gt;
  30. &lt;div class=&quot;box-header&quot;&gt;
  31. &lt;div class=&quot;b1&quot;&gt;
  32. &lt;div class=&quot;b11&quot;&gt;
  33. 1
  34. &lt;/div&gt;
  35. &lt;/div&gt;
  36. &lt;div class=&quot;new&quot;&gt;
  37. New Referral
  38. &lt;/div&gt;
  39. &lt;/div&gt;
  40. &lt;form action=&quot;/action_page.php&quot;&gt;
  41. &lt;div class=&quot;form_inp&quot;&gt;
  42. &lt;div class=&quot;disflex&quot;&gt;
  43. &lt;div class=&quot;input-container&quot;&gt;
  44. &lt;i class=&quot;fa fa-user icon&quot;&gt;&lt;/i&gt;
  45. &lt;input class=&quot;input-field&quot; type=&quot;text&quot; placeholder=&quot;Username&quot; name=&quot;usrnm&quot;&gt;
  46. &lt;/div&gt;
  47. &lt;div class=&quot;input-container&quot;&gt;
  48. &lt;i class=&quot;fa fa-user icon&quot;&gt;&lt;/i&gt;
  49. &lt;input class=&quot;input-field&quot; type=&quot;text&quot; placeholder=&quot;Username&quot; name=&quot;usrnm&quot;&gt;
  50. &lt;/div&gt;
  51. &lt;/div&gt;
  52. &lt;div class=&quot;disflex&quot;&gt;
  53. &lt;div class=&quot;input-container&quot;&gt;
  54. &lt;i class=&quot;fa fa-envelope icon&quot;&gt;&lt;/i&gt;
  55. &lt;input class=&quot;input-field&quot; type=&quot;text&quot; placeholder=&quot;Email&quot; name=&quot;email&quot;&gt;
  56. &lt;/div&gt;
  57. &lt;div class=&quot;input-container&quot;&gt;
  58. &lt;i class=&quot;fa fa-envelope icon&quot;&gt;&lt;/i&gt;
  59. &lt;input class=&quot;input-field&quot; type=&quot;text&quot; placeholder=&quot;Email&quot; name=&quot;email&quot;&gt;
  60. &lt;/div&gt;
  61. &lt;/div&gt;
  62. &lt;div class=&quot;disflex&quot;&gt;
  63. &lt;div class=&quot;input-container&quot;&gt;
  64. &lt;i class=&quot;fa fa-key icon&quot;&gt;&lt;/i&gt;
  65. &lt;input class=&quot;input-field&quot; type=&quot;password&quot; placeholder=&quot;Password&quot; name=&quot;psw&quot;&gt;
  66. &lt;/div&gt;
  67. &lt;div class=&quot;input-container&quot;&gt;
  68. &lt;i class=&quot;fa fa-envelope icon&quot;&gt;&lt;/i&gt;
  69. &lt;input class=&quot;input-field&quot; type=&quot;text&quot; placeholder=&quot;Email&quot; name=&quot;email&quot;&gt;
  70. &lt;/div&gt;
  71. &lt;/div&gt;
  72. &lt;div class=&quot;full-input-container&quot;&gt;
  73. &lt;input class=&quot;input-field&quot; type=&quot;text&quot; placeholder=&quot;Email&quot; name=&quot;email&quot;&gt;
  74. &lt;/div&gt;
  75. &lt;div class=&quot;full-input-container&quot;&gt;
  76. &lt;input class=&quot;input-field&quot; type=&quot;text&quot; placeholder=&quot;Email&quot; name=&quot;email&quot;&gt;
  77. &lt;/div&gt;
  78. &lt;/div&gt;
  79. &lt;button type=&quot;submit&quot; class=&quot;btn&quot;&gt;SEND REFERRALS&lt;/button&gt;
  80. &lt;/form&gt;
  81. &lt;/div&gt;
  82. &lt;/body&gt;
  83. &lt;/html&gt;

<!-- end snippet -->

huangapple
  • 本文由 发表于 2023年3月4日 00:28:12
  • 转载请务必保留本文链接:https://go.coder-hub.com/75629605.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定