Which one is correct about the format of width?

I find sometimes display Width="30" and sometimes dispaly Width="30px" in the editor of VS 2008, but no error occurs on the two formats

but Which one is the correct format of width?


        <asp:TextBox ID="TextBox1" runat="server" Width="30"></asp:TextBox>
        <asp:TextBox ID="TextBox2" runat="server" Width="30px"></asp:TextBox>


SuperCool Multiple ZIP - A utility to unzip multiple files and work with multiple zip files

SuperCool Random Number Generator
0
mycwcgr
5/4/2009 8:17:00 AM
asp.net.client-side 24353 articles. 0 followers. Follow

7 Replies
841 Views

Similar Articles

[PageSpeed] 19

They both produce the same html. If you don't mention a unit, px is used. So in the output html, you'll see 30px in both cases.


All that glitters is gold-
Only shooting stars break the mold.
0
HeartattacK
5/4/2009 8:22:34 AM

Hi,
    Actually both are working as same.
    By default Tabels width take values in pixels
    if you not specifying the unit as px
    e.g. if you specify width = "10" or width="10px" both are correct way.
 its better to put widht in percentage like width = "10%" its compatible
 to all browsers.

  I hope this may help you.


Thank You
Manoj Chavan
-------------------------------------------
Web Application Developer(C#.NET, ASP.NET, C++.NET)
My Blog
Always think high, Always Dream High.
If this post helps you then plz Mark It as Answer
0
manojlev
5/4/2009 8:43:09 AM

All i can tell you is that HTML is so loose a language that even if you write

<input type="text" width="10px" innerPassword="hello"/> , still you'll see the nice textbox on your page.


SHASHANK BHIDE
CAPGEMINI INDIA
"THE ROAD TO SUCCESS IS ALWAYS UNDER CONSTRUCTION MARK MY RESPONSE AS ANSWER TO HELP ME BUILD IT :)"
0
shashankgwl
5/4/2009 10:59:07 AM

 Bydefault the width or height is in pixel format so you specify it or not, it is not mandatory

 if you just change px to cm, see the changes and if you remove cm it is bydefault in pixel, This means for any other Unit of Measure you have specify the type. cm,inch or etc

<asp:TextBox ID="TextBox2" runat="server" Width="30cm"></asp:TextBox>

 

Regards

Asif


Please remember to click “Mark as Answer” on the post that helps you.
This can be beneficial to other community members reading the thread.
0
asifchouhan
5/4/2009 11:17:30 AM

 Hi mycwcqr,

For better understanding of measurement units please refer to the following article.

http://css.weblogsinc.com/2005/02/17/the-difference-between-px-pt-and-em/


Please mark as Answer if it helps u. Thanks!

Parth Patel
Techsture Technologies
Software Developer
Ahmedabad
0
Coool
5/4/2009 11:18:19 AM

I believe that Firefox requires the "px" part or it won't work.

NC...

 

0
NC01
5/4/2009 11:42:10 AM

Actually NC, if you put Width='100' for a server side control, asp.net automatically converts it to width='100px' in the output html. As a result, it'll work on FF too. Of course, it has to be a server side control for the conversion to work.


All that glitters is gold-
Only shooting stars break the mold.
0
HeartattacK
5/5/2009 4:04:00 AM
Reply:

Web resources about - Which one is correct about the format of width? - asp.net.client-side

Correct name (botany) - Wikipedia, the free encyclopedia
If there are two or more legitimate names for the same taxon (with the same circumscription, position and rank), then the correct name is the ...

Facebook Corrects Bug That Exposed Email Addresses, Phone Numbers Of Some 6M Users
The good news: The Facebook Security team snuffed out a bug that exposed some 6 million Facebook users’ email addresses and phone numbers. The ...

Present and Correct (@presentcorrect) on Twitter
Sign in Sign up To bring you Twitter, we and our partners use cookies on our and other websites. Cookies help personalize Twitter content, tailor ...

Perspective Correct for iPhone, iPod touch, and iPad on the iTunes App Store
Get Perspective Correct on the App Store. See screenshots and ratings, and read customer reviews.

Using the correct terms - Flickr - Photo Sharing!
Today’s Office OFFline comic was inspired by "Facebook Reverts Terms of Service After Complaints" (http://www.insidefacebook.com/2009/02/18/ ...

DA Mike Ramos Speaks Out in Support of Law Enforcement and Corrects Jon Stewart of The Daily Show - YouTube ...
On Monday, December 1, 2014, Jon Stewart of The Daily Show incorrectly stated that officers shot Dante Parker—using this local incident to fuel ...

Usada ‘immediately correct the false suggestion’ relating to Floyd Mayweather doping claims
Floyd Mayweather received an injection of saline and vitamins on the eve of his superfight against Manny Pacquiao, the United States Anti-Doping ...

We're not a 'politically correct circle-jerk': UC Confessions Facebook page defend actions after racist ...
Anonymous Facebook group designed for students at the University of Canberra apologises for publishing racist image - but only because it turned ...

Jack Viney decision 'probably correct': AFL football operations manager Mark Evans
... bump remains an ongoing one, but the final decision of the AFL appeals board to overturn Jack Viney's two-match suspension was "probably correct" ...

ANZ corrects AFR on dividend, tax - HeraldSun Search Search
ANZ Bank today confirmed that it expected to fully frank dividends for the foreseeable future.

Resources last updated: 12/18/2015 5:51:28 PM