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 use auto with a height in css

    How would you go about placing li in different divs?

    how to make table header freeze/fixed when scrolling in html/css?

    How can I use True Type Collection (.ttc) in JavaFX?

    Website layout moving slightly between pages - how to stop it

    How to change header and footer to full width

    How to center a block of social icon background images?

    How to draw solid/dotted/dashed lines using most basic HTML/CSS possible (for tcpdf to render them correctly)

    How can I use JQ to pick out a parent whose child is hr.strong?

    How can I set the text on the right of a glyphicon into a Twitter BootStrap theme?

    How can I add a hover effect to icons with CSS? [closed]

    Div doesn´t show background color after float:left

    JS+CSS How to display images from an array from top right to bottom left

    How can I get Outlook to display my tables properly

    Some doubts about how make an image clickable using CSS

    Text and image in div - How to align correctly?

    How to set css for first div, if there's no second div

    How to build a special polygon (a kite shape) with HTML & CSS only?

    HTML/CSS/JS: How to force browser to save password from a non-'password' type input?

    How can I increase the size of a gomap popup window?

    How to toggle class using jquery if else statement?

    How to add css to a div once it hits the top of the page (when scrolling)?

    How can I resize images that are loaded onto a page?

    How to place two labels around an image (dynamically); right and bottom?

    JavaScript, AngularJS: How do I know if element is larger than its container?

    CSS how to align one word left and another word right within the same div?

    How to get the first letter of each word to be a different size and the rest to be the same size

    How to make the effects of jQuery's $(element).css() persistent?

    CSS Syntax - How to interpret this?

    How to get rid of css inherited from a css file?