How to make label inside div to be in the same position as lower ones


Tags: css,html

Problem :

I have a problem. I have a code:

<div><label>Comments:</label>0</div>
<div><label>Author:</label>AuthorName</div>
<div><label>Rating</label>5/5</div>

How can I make it to be in the same width to look aesthetic? I tried to change .css label to specific width and float div to the left but it didn't work. Can somebody help me?

I would love to put it into a table with td's with the same width but I cannot change what I have in divs... Please help me.



Solution :

div label {
    display: inline-block;
    width: 150px;
}

I find this solution tends to work better than float.


    CSS Howto..

    How to set textbox width fit in table cell CSS

    How to get opaque text on div with transparency?

    how to use linked animated css?

    How to change the color of header?

    How to make show/hide div with a toggle using CSS?

    How to rotate multiple words with CSS?

    How can I resize these divs while keeping the same layout?

    How to apply master page and css to child page

    How to play a video inside a logo

    How to change the color of first row of first table using css

    How can I have a transparent overlay and center with flex box?

    How to bring a specific overlayed image to the foreground

    How can I add to an image an HTML link using Google Chrome extension?

    how do I properly position & scale these elements in CSS?

    How to remove div backgrounds?

    How to align TH Header with TD in TBody

    How can I transform dots to line between CSS menu items?

    How to load dynamic content (get, html, data) via jquery/css in Wordpress?

    How to style text in JQuery?

    How to avoid IE11 “slow” evaluation of CSS :invalid and :valid pseudo selectors

    How can I line up my CSS DIVs

    How do I place a
    beside an image?

    How can I fill a fixed-size
    with a variable-size

    ?

    How do I use CSS to centre this content?

    How to divide content with CSS even, odd?

    How to replace cycle('float: left', 'float: right') to use pure css?

    How to make display:flex work for responsiveness - Bootstrap?

    how to recreate tex's over- underbracket using css

    How to center a IMG tag horizontaly and vertically using html and css in ie7?

    How can I display links in 2 rows?