Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Stylesheet CSS Fieldset DIV Label Width?

Posted on 2014-01-11
2
Medium Priority
?
515 Views
Last Modified: 2014-01-11
Q. How do I change the width of several nested Labels in a fieldset?

This doesn't work:
        fieldset.managerList > div > label
        {
             width: 200px;
        }

<fieldset class="managerList">
    <div>
       <label>First Name:</label>
    </div>

    <div>
       <label>Last Name:</label>
    </div>

    <div>
       <label>Nick Name:</label>
    </div>
</fieldset>
0
Comment
Question by:WorknHardr
2 Comments
 
LVL 52

Accepted Solution

by:
Carl Tawn earned 1200 total points
ID: 39773611
The reason it isn't doing anything is that Label elements are inline elements rather than block, so width has no effect by default.

If you change the display attribute to inline-block then you should get the effect you want:
fieldset.managerList > div > label
{
     display: inline-block;
     width: 200px;
}

Open in new window

0
 

Author Closing Comment

by:WorknHardr
ID: 39773689
thx...
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
In this tutorial viewers will learn how to position overlapping items using z-index in CSS. They will also learn the restrictions on the z-index property.  Create a new HTML document with an internal stylesheet.: Create a div in CSS and name it Red.…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.
Suggested Courses

783 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question