PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Friday, July 1, 2022

[FIXED] What is the correct code for label placement above an input?

 July 01, 2022     css, html, liquid, shopify     No comments   

Issue

What is the proper code required to make the label "Custom Name" appear above the input field instead of beside it (See image below for how it currently looks). I'm guessing it's in the style code at the bottom but not sure what it needs to be to do so. Any help would be appreciated!

<p class="line-item-property__field">
<label  for="">Custom Name</label>
<input required id="monogram" style="width:200px; max-width:100%;" type="text" name="properties[Monogram]">
</p>

<style>
.ep_inline_block {display:inline-block;vertical-align:middle;margin-left:10px;}
.ep_block {display:block;margin-top:10px;margin-bottom:2px;}
</style>

Image for reference


Solution

Use flexbox.

.line-item-property__field {
  display: flex;
  flex-direction: column;
}

.ep_inline_block {
  display: inline-block;
  vertical-align: middle;
  margin-left: 10px;
}

.ep_block {
  display: block;
  margin-top: 10px;
  margin-bottom: 2px;
}

input {
  width: 200px;
  max-width: 100%;
}
<p class="line-item-property__field">
  <label for="monogram">Custom Name</label>
  <input required id="monogram" type="text" name="properties[Monogram]">
</p>



Answered By - Prosy Arceno
Answer Checked By - Candace Johnson (PHPFixing Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing