Solved

How to make checkbox small in C#.net

Posted on 2006-07-06
14
549 Views
Last Modified: 2008-02-01

I am using C#.net to develop a web form. I need a few very small checkbox on the form. However, the smallest that I can get from C#.net is xx-smaller.

Any idea?

Thanks,
0
Comment
Question by:penglu
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 3
  • 2
  • +2
14 Comments
 
LVL 25

Expert Comment

by:Rouchie
ID: 17056604
I don't believe this is possible to achieve because the operating system controls the size of the textbox, not the browser.  They are always rendered at a standard size.
I've tried this morning using html and css but neither affect the checkbox size.
0
 
LVL 3

Expert Comment

by:zawedikian
ID: 17056771
hey
u can give the checkbox a css class and in the class (for ex checkstyle),

put

.checkstyle
{
size = 10px
}
0
 
LVL 25

Expert Comment

by:Rouchie
ID: 17056860
zawedikian - that doesn't work.  SIZE is not a valid CSS property name.

The correct property names, size and width do not affect the checkbox size:
   style="width:50px; height:50px"

Increasing the font size does also not work.
0
Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

 

Expert Comment

by:Priyang
ID: 17056974
It wont work ,

U need to change put the following in InitializeComponent

checkbox1.Size = new System.Drawing.Size(192, 24);

By changing the values in braces u  can change size.
     
0
 
LVL 3

Expert Comment

by:zawedikian
ID: 17058033
hi
Rouchie is right. i meant by size the width. in the css class, u can out width = 10px for ex.
the use of css class is better than putting them near every checkbox. bcz if u decide to change the size or the color or whatever of the checkbox, u do it in the class only and not on every checkbox.

0
 
LVL 25

Expert Comment

by:Rouchie
ID: 17058068
As far as I know there is no way to alter the size of a checkbox.  Come to think of it, I have never seen this done before.  You have 2 alternatives though penglu:

 1. Use a Flash-based form (might involve learning Macromedia Flash)
 2. Use an image of a checkbox instead, and use javascript to swap it when checked
0
 

Author Comment

by:penglu
ID: 17058400

Hi,

Thanks for the response. Howver, I have tried using css

<style>
    input.chk {height:8px; width:8px; margin:0px;}
</style>

the size of check DOES change, but the text on the right side of the checkbox is not aligned well with the text, which is not as good as the server side checkbox.

Peng

0
 
LVL 25

Expert Comment

by:Rouchie
ID: 17058580
Whoa - I've not seen that before!  Note that it doesn't work in Firefox!  All I get in Firefox is a huge white space with the normal sized checkbox in the center!
0
 
LVL 25

Expert Comment

by:Rouchie
ID: 17058594
Can you use CSS to align the text?

<input type="checkbox" name="option1" value="Choice" style="height:8px; width:8px; vertical-align:middle;"> Choice<br/>

or

    <span style="vertical-align:middle;">
        <input type="checkbox" name="option1" value="Choice" style="height:8px; width:8px;"> Choice
    </span>
    <br/>
0
 

Author Comment

by:penglu
ID: 17058997

<input type="checkbox" name="option1" value="Choice" style="height:8px; width:8px; vertical-align:middle;"><font style="height:8px; width:8px; vertical-align:middle"> Choice</font><br/>

works OK.
0
 
LVL 3

Expert Comment

by:zawedikian
ID: 17059013
hi
for the text, u can use text-padding or padding (from bottom or top)...
0
 
LVL 1

Accepted Solution

by:
DarthMod earned 0 total points
ID: 17677934
PAQed with points refunded (250)

DarthMod
Community Support Moderator
0

Featured Post

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

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

FAQ pages provide a simple way for you to supply and for customers to find answers to the most common questions about your company. Here are six reasons why your company website should have a FAQ page
Australian government abolished Visa 457 earlier this April and this article describes how this decision might affect Australian IT scene and IT experts.
The viewer will get a basic understanding of what section 508 compliance can entail, learn about skip navigation links, alt text, transcripts, and font size controls.
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

724 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