Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What css is required to get editor-label and editor-field displayed with a side by side layout?

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

like image 376
CRG Avatar asked Apr 21 '11 01:04

CRG


People also ask

How do I display labels side by side in HTML?

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.

How do I style a label and input in CSS?

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.

What is label in CSS?

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.

How do I display two columns side by side in HTML?

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.


1 Answers

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;
}
like image 86
Shawn Mclean Avatar answered Oct 11 '22 02:10

Shawn Mclean