So the default MVC application has the following css (in Site.css) -
/* Styles for editor and display helpers
----------------------------------------------------------*/
.display-label,
.editor-label
{
margin: 1em 0 0 0;
}
.display-field,
.editor-field
{
margin:0.5em 0 0 0;
}
.text-box
{
width: 30em;
}
.text-box.multi-line
{
height: 6.5em;
}
.tri-state
{
width: 6em;
}
What changes are required? Thanks
We specify the margin-bottom of our <div> element. Then, we set the display of the <label> element to "inline-block" and give a fixed width. After that, set the text-align property to "right", and the labels will be aligned with the inputs on the right side.
There are two ways to pair a label and an input. One is by wrapping the input in a label (implicit), and the other is by adding a for attribute to the label and an id to the input (explicit). Think of an implicit label as hugging an input, and an explicit label as standing next to an input and holding its hand.
The label is a normal text, by clicking which, the user can select the form element. It facilitates the use of the form, since it is not always convenient to get into form elements with the cursor. The <label> tag is also used to define keyboard shortcuts and jump to the active element like links.
The most common way to place two divs side by side is by using inline-block css property. The inline-block property on the parent placed the two divs side by side and as this is inline-block the text-align feature worked here just like an inline element does.
This is a css question. What you are seeking is the property called display: inline-block
.
What this does it set the element as a block but does not put a page break after and before the element as block
would do.
.display-field,
.editor-field
{
display: inline-block;
margin:0.5em 0 0 0;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With