Hi,
Can anyone tell me how to use css to line up different types of form controls? Different types seem to behave differently.
I have a textbox, dropdownbox and a button along 1 line across the page. I want to make all of them the same height and vertically align them. Here is my code -
<div>
-
<input name="SearchText" type="text" id="tbxSearchText" style="width:50px;font-size:12px;line-height:19px;" />
-
<select name="SearchBy" id="ddlSearchBy" style="width:110px;height:19px;font-size:12px;position:relative;bottom:1px;">
-
<option value="0">Family Name</option>
-
<option value="1">Given Names</option>
-
</select>
-
<input type="submit" name="btnSearch" value="Search" onclick="return checkForm();" id="btnSearch" class="button" style="height:20px;position:relative;line-height:1.1em;"/>
-
</div>
-
Thanks
6 5093
'vertical-align' should be working for you. 'height' should work on the text box but won't affect the other input elements since they're part of the browser.
For input text and button you can add height and for select(combobox ) line-height and padding should help to get the same height.
It is not perfect but it looks good enough but the code looks really messy.
To make the textbox and button the same I have to use "height:25p x" and "height:15p x" which is not logical.
Thanks guys - <div>
-
<input name="SearchText" type="text" id="tbxSearchText" style="width:50px;height:15px;line-height:5px;position: relative; top: 50%;" />
-
<select name="SearchBy" id="ddlSearchBy" style="width:110px;line-height:3px;padding:2px;position: relative; top: 50%;">
-
<option value="0">Family Name</option>
-
<option value="1">Given Names</option>
-
</select>
-
<input type="submit" name="btnSearch" value="Search" onclick="return checkForm();" id="btnSearch" class="button" style="height:25px;padding-top:3px;padding-bottom:3px;line-height:6px;position: relative; top: 50%;"/>
-
</div>
-
Hi,
I know this is one week later, but I'll try to help you out here. It seems you already found a solution, but as you said it looks messy. Maybe I can give it a try. I think you're trying to have a clean row of controls, correct?
Try this: -
<html>
-
<head>
-
<title>Title</title>
-
</head>
-
-
<body>
-
<div>
-
<input type="text" name="SearchText" size="20" />
-
<select name="SearchBy">
-
<option value="0">Family Name</option>
-
<option value="1">Given Names</option>
-
</select>
-
<input type="submit" name="btnSearch" value="Search" onclick="return checkForm();" />
-
</div>
-
</body>
-
</html>
-
You could even have them within a table. This is what I normally do when placing form controls on a page. (Although it basically has the same output, it comes in handy when you have a lot of stuff going on, such as text boxes, drop-downs, buttons, etc.) -
<html>
-
<head>
-
<title>Title</title>
-
</head>
-
-
<body>
-
<table border="0">
-
<tr>
-
<td><input type="text" name="SearchText" size="20" /></td>
-
<td>
-
<select name="SearchBy">
-
<option value="0">Family Name</option>
-
<option value="1">Given Names</option>
-
</select>
-
</td>
-
<td><input type="submit" name="btnSearch" value="Search" onclick="return checkForm();" /></td>
-
</tr>
-
</table>
-
</body>
-
</html>
-
John,
Thanks for your reply.
I have moved on to another part of my project now. I am glad to have received your suggestions though because I will come back to it later. Happy to have a better alternative to my messy code.
First, never use tables for layout.
Second, how does that work without the form element?
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Lauren Quantrell |
last post by:
In terms of resources, wondering if it makes a difference in adopting
one of the three options below for resizing controls on a form and
controls on a subform at the same time.
option a.) Put the code all in the main form and refer to the controls
on the subform in the main form's OnResize event.
option b.) Put the code for the main form controls in the main form's
OnResize event and put the code for the subform controls in the...
|
by: J L |
last post by:
I need to loop through a form's controls collection and delete some
based on type and location. I have tried For..Each and For i = 0 to
form.controls.count - 1 but when I delete any it messes up the loop.
What is the correct way to go about this. I thought this was answered
before but can not find it.
TIA,
John
|
by: Dries De Rudder |
last post by:
Hi,
I am trying to bind an object to form controls. I've got an object
MyObject which has some properties e.g. ID.
I've got a form, Form1, that contains a textbox ,TextBox1, now I want to
bind the value of the ID-property of a MyObject-object to the TextBox1.
I've tried doing this:
|
by: Adam Right |
last post by:
Hi,
I want to get the controls of the windows form. I know that
form.Controls give me the list of controls but i have a problem. For
example, the toolstripmenu control cannot be reached with that way. My goal
is to list the items of the toolstripmenuitem on the form. I have only the
typename of the windows form so i am invoking the form with its typename,
and i can reach the controls like buttons,labels etc. But i cannot get the...
|
by: Adam Right |
last post by:
Hi,
I want to get the controls of the windows form. I know that
form.Controls give me the list of controls but i have a problem. For
example, the toolstripmenu control cannot be reached with that way. My goal
is to list the items of the toolstripmenuitem on the form. I have only the
typename of the windows form so i am invoking the form with its typename,
and i can reach the controls like buttons,labels etc. But i cannot get the...
| |
by: jmp |
last post by:
(I hope this isn't considered too far off-topic.)
I work as a developer on a browser product found on handheld devices,
and I'm trying to specify behavior for the browser to make it "as
compatible as possible" with reference browsers (IE, Firefox, Opera,
NS, etc??) when presented with HTML content containing form controls
(input, textarea, select/option) in the absence of enclosing form
element tags.
Obviously in the absence of...
|
by: Ryan |
last post by:
Ok.. I have a form with lots of stuff on it; a tool strip panel, menu strip,
data binding elements (dataset, binding source, table adapter), tab control
with 7 tab pages, each page contains a picture box, lots of text boxes (for
input).. you get the idea. All of a sudden everything on the form has
disappeared, it looks like a blank, newly created form. I can still get to
the properties of every item on the form using the drop-down box in...
|
by: Mike |
last post by:
Hi,
I have a form with some controls, and a different class that needs to
modify some control properties at run time.
Hoy can I reference the from so I have access to its controls and
therefore being able to modify its properties?
|
by: dhtml |
last post by:
I have written an article "Unsafe Names for HTML Form Controls".
<URL: http://jibbering.com/faq/names/ >
I would appreciate any reviews, technical or otherwise.
Garrett
--
comp.lang.javascript FAQ <URL: http://jibbering.com/faq/ >
|
by: =?Utf-8?B?UmljaA==?= |
last post by:
A lot of users at my workplace use different screen resolutions, and I build
apps to use 1680 x 1050 pixels res by default. But some users are using 800
x 600, and the apps are too large for their screen.
I used to write code in Java a few years ago (2005), and you could stretch a
form with the mouse and all the controls and fonts would resize to larger or
smaller size. Does .Net framework 3.5 support this kind of functionality?
Or -...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
| |
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |