css - Label autowidth makes the td wider -


I have a label inside the table TD, the problem is that when the label width is greater than the TD width then the label increases In only one line, TD is not allowed to make as much as possible and to view all the text. What I want is that when the label width is greater than its container, the labels make the second line.

  css .pdata {font-size: 10px; } And lieutenant; Table valis = "top" cellspacing = "0" cellpadding = "0" range = "0" height = "150" & gt; & Lt; Tbody & gt; & Lt; Tr valign = "top" & gt; & Lt; td class = "profile-company-text" & gt; & Lt; Label class = "pdata" & gt; Label class = "bold" style = "width: 140px; display: inline-block" & gt; Email: & lt; / Labels & gt; & Lt; Label data-bind = "text: email" & gt; & Lt; / Labels & gt; & Lt; Br> & Lt; / Labels & gt; & Lt; / Span & gt; & Lt; / TD & gt; & Lt; / TR & gt; & Lt; / Tbody & gt; & Lt; / Table & gt;    

It seems that the size of the table is changing to give your browser the table "Best-fit" for your content If you want to apply the maximum width to the column in the table that contains the label, then use the CSS max-width attribute.

Unfortunately, there is no way to really answer your question for many reasons.

For example, you show the label "Email" above, do not wrap too much (some other style is absent, which you have not provided) because it is a word, like hyphenation digits or spaces like No confusing digits To reduce confusion, you should provide more information such as the output of the output of the mockup, and a code sample, which in fact reproduces undesirable behavior.

In addition to this, markup is a bit of a mess if you are using some kind of generator, make sure it is configured correctly. Some well-meaning issues that I see I:

  1. The nesting label is incorrect I label should contain only non-labeled content, linked to any label other than input.
  2. You do not have to open a span tag span .

    And in the end, you should consider some of the best practices to make your code more readable, more vocabulary and easy to maintain:

    1. Use T inline styles (e.g., attribute on the style element). Assign the classes needed in the markup and use an external stylesheet or style block in the document to apply the presentation style.
    2. Do not use the colespacing , cellpadding , etc. on your table as above. Use appropriate CSS attributes instead.
    3. You do not have any label element associated with input element, this is not the worst thing in the world, but a label The whole purpose of providing a reference to a form input is if you just want block of text, then p . Use a more suitable element as .

Comments

Popular posts from this blog

Verilog Error: output or inout port "Q" must be connected to a structural net expression -

jasper reports - How to center align barcode using jasperreports and barcode4j -

c# - ASP.NET MVC - Attaching an entity of type 'MODELNAME' failed because another entity of the same type already has the same primary key value -