HTML Select cutting text off - html

Ok, as usual, I come here as a last resort after pulling what's left of my hair out and not finding the solution online.
Have a simple table with one row and three cells. Inside two cells are fieldsets (I like the look) containing a <select> and two buttons. Everything looks as I want it, except that the text for the options are cut off.
I've tried resizing the select, but can't find any reference on resizing the option itself.
What am I doing wrong?
The HTML:
<div id='tabs-1' style='width: 95%;'>
<table style='width: 98%; margin-left: auto; margin-right: auto;'>
<tr>
<td style='width: 33%;text-align: center;'>
<fieldset style='height: 300px;width: 90%;'>
<legend>Manual</legend>
<br>
<div style='text-align: center;'>
<a href="#" onclick='getPage("SheriffManual")' target="_self">
<img src="images/manualIcon.jpg" alt='Manual' height="65">
<br>
Sheriff's Policy and Procedure
</a>
</div>
</fieldset>
</td>
<td style='width: 33%;text-align: center;'>
<fieldset style='height: 300px;width: 90%;'>
<legend>Memorandum</legend>
<br>
<div style='width: 100%;" text-align: center;'>
<select style='width: 90%;' size="8" id='selSheriffMemorandum' name="selSheriffMemorandum" value="">
<option value='memorandum/MINIMUM APPLICANT STANDARDS FOR DETENTION, PEACE OFFICERS AND TELECOMMUN.pdf'>Minumum Applicant Standards</option>
<option value='memorandum/Memorandum EMPLOYEE SMOKING AREAS.pdf'>Employee Smoking Areas</option>
</select>
<br><br>
<div style='float: left; margin-left: 75px;'>
<button>View</button>
</div>
<div style='float: right; margin-right: 75px;'>
<button>Download</button>
</div>
</div>
</fieldset>
</td>
<td style='width: 33%;text-align: center;'>
<fieldset style='height: 300px;width: 90%;'>
<legend>Directives</legend>
<br>
<select size='8' style='width: 90%' id='selSheriffDirectives' name='selSheriffDirectives' value=''>
<option value='directives/SHERIFFS DIRECTIVE NO 2015-09-01 WORK PLACE VIOLENCE.pdf'>Workplace Violence</option>
<option value='directives/Directive ANNUAL TUBERCULOSIS SCREENING.pdf'>Annual Tuberculosis Screening</option>
<option value='directives/Sheriffs Directive No. 02-03 - Bereavement Leave.pdf'>Bereavement Leave</option>
<option value='directives/SHERIFFS DIRECTIVE Mental Health Pre-Screening and Diversion NO 2015-01.pdf'>Mental Health Pre-Screening</option>
</select>
<br><br>
<div style='float: left; margin-left: 75px;'>
<button>View</button>
</div>
<div style='float: right; margin-right: 75px;'>
<button>Download</button>
</div>
</fieldset>
</td>
</tr>
</table>
</div>
The result:
UPDATE: I took out all the CSS and javascript for the page, and the select renders as expected. After putting everything back in, I realized that it was jquery.ui.js causing the problems -- I'm using jquery's tabs and it's setting the <select> option width the same as the tab widths. Now I just have to find out what/how I need to override jquery.

How about adding a scrollbar to your select elements?
<select style='width: 90%; overflow: scroll' size="8" id='selSheriffMemorandum' name="selSheriffMemorandum" value="">
...
</select>

Turns out there's a simple fix (courtesy of Select box truncating text when body font size changed via javascript on document ready in IE 9):
$('select').append(' ');
Forces the select to be redrawn.

Change the height or padding of <option>
option {
height:8px;
padding:8px;
}

Related

how to shift the right most box towards the left and of same size as of box1 and box2

I need help to bring the right most box with heading 'This is box3' and id = "bin"
towards the left side just beside the '<- this is button 2' and '<- this is button 3'.
Also the size of the right most box should be of same size as of the other two boxes.
<html>
<body>
<div align="center"><font color="red"><b><span id="Error_App"></span></b></font></div><br>
<font size=3><b>This is box1 </b></font>
<table border=0 width=100%>
<tr>
<td width=35%>
<select multiple="multiple" id="teams" style="width:100%;" size="10">
<option value=AA>teamA</option>
<option value=BB>teamB</option>
<option value=CC>teamC</option>
</select>
</td>
<td width=10% align="left">
<input title='SelectTeamMem.' type="button" id="btn_1" value="this is button 1 ->"></input>
</td>
<td width=50% rowspan= "3" valign = "center">
<font size=2>This is box 3</font>
<br>
<select multiple="multiple" id="bin" style="width:100%;" size="10">
</select>
</td>
</tr>
<tr>
<td>
<div align="center"><font color="red"><b><span id="Error_App"></span></b></font></div><br>
<font size=3><b>This is box 2 </b></font>
</td>
<td width=30% align="left">
<input title='SelectTeamMem.' type="button" id="btn_2" value="<- this is button 2"></input>
<br>
<input title='SelectTeamMem.' type="button" id="btn_3" value="<- this is button 3"></input>
</td>
</tr>
<tr>
<td width=30% valign = "bottom">
<select multiple="multiple" id="mems" style="width:100%;" size="10">
<option value=16313>member1</option>
<option value=16250>member2</option>
<option value=15041>member3</option>
<option value=15041>member4</option>
<option value=15041>member5</option>
</td>
<td width=50% valign="center">
<input title='SelectMembers' type="button" id="btn_4" value="this is button4 ->"></input>
</td>
</tr>
</table>
Move away from the <table> layout and no one gets hurt!
How can I lay this out without a table?!
There are two crucial details
For this example, we are going to rely heavily on:
display: inline-block — look for the simple explanation here — basically, inline-block elements will place themselves on the same line whilst also allowing widths and heights
vertical-align: middle — a little information here — basically, the inline elements will vertically center themselves on their line
The basic layout
Our layout consists of five crucial building blocks:
two <div>'s with display: inline-block — this creates two columns.
two <select>'s with display: inline-block — this allows buttons one and four to align themselves next to each of the selects in the left column
two <button>'s with display: inline-block — these are buttons one and four which line themselves next to each <select>
three <label>'s with display: block — this brings the labels above their respective select groups
The <form> that wraps these elements is given an appropriate width and margin: 0 auto to center everything horizontally. It prevents the right column from sliding underneath the left if the browser window isn't wide enough.
Put everything together and we get...
Show me the example already!
Sure, here it is! You can run the code snippet at the bottom.
div {
display: inline-block;
vertical-align: middle;
padding: 20px 0 0 20px;
}
form {
margin: 0 auto;
width: 622px;
}
label {
display: block;
font-weight: bold;
}
select {
display: inline-block;
vertical-align: middle;
width: 200px;
}
button {
display: inline-block;
vertical-align: middle;
margin-left: 20px;
}
#btn_2, #btn_3 {
display: block;
margin: 1.5em 0 0 225px;
}
<form>
<div class="left">
<label for="teams">This is box1</label>
<select multiple="multiple" id="teams" size="10">
<option value=AA>teamA</option>
<option value=BB>teamB</option>
<option value=CC>teamC</option>
</select>
<button name="SelectTeamMem" id="btn_1" value="this is button 1 ->">
this is button 1 ->
</button>
<button name="SelectTeamMem" id="btn_2" value="<- this is button 2">
<- this is button 2
</button>
<button name="SelectTeamMem" id="btn_3" value="<- this is button 3">
<- this is button 3
</button>
<label for="mems">This is box 2</label>
<select multiple="multiple" id="mems" size="10">
<option value=16313>member1</option>
<option value=16250>member2</option>
<option value=15041>member3</option>
<option value=15041>member4</option>
<option value=15041>member5</option>
</select>
<button name="SelectMembers" id="btn_4" value="this is button4 ->">
this is button4 ->
</button>
</div>
<div class="right">
<label for="bin">This is box 3</label>
<select multiple="multiple" id="bin" size="10">
</select>
</div>
</form>

Why won't these child divs align to the right-side of their parent?

I am trying to achieve a simple UI with the following design:
But am getting the following (I added solid red lines around each <div>s border so I could see div borders; will be removing them once everything is placed correctly):
Here is the code:
<html>
<head>
<title>Options</title>
<style>
#control-panel-div {
right: 0px;
}
</style>
</head>
<body>
<div id="content">
<div id="option-sel-div" style="border: 1px solid red;">
<select id="provider-sel">
<option selected="selected" id="default">Select an option</option>
<option id="1">option1</option>
<option id="2">option2</option>
</select>
</div>
<div id="config-manage-div" style="border: 1px solid red;">
<div id="control-panel-div" style="border: 1px solid red;">
<input id="add-config-btn" type="button" value="Add"/>
<input id="remove-config-btn" type="button" value="Remove"/>
</div>
<div id="table-div" style="border: 1px solid red;">
<div id="config-datatable">
<table>
<tr>
<td>
Blah
</td>
<td>
bleh
</td>
</tr>
<tr>
<td>
Fizz
</td>
<td>
Buzz
</td>
</tr>
</table>
</div>
</div>
</div>
</div>
</body>
</html>
I believe that by setting control-panel-div's right property have a value of 0px, then all of its children should be right-aligned, but for the life of me I can't get this to work (I have also tried text-align, and box-align). Thanks in advance.
I won't comment about using tables for this, but you can just change your CSS to:
#control-panel-div {
text-align: right;
}​
to get the effect.
jsFiddle example
Try
#control-panel-div {
float: right;
}
Here is the doc if you need to read on the property: http://www.w3schools.com/css/css_float.asp
Without much hassle, and with clearer markup:
<style type="text/css">
form {
width: 300px;
}
fieldset {
float: right;
border: 0;
}
table {
clear: both;
}
</style>
<form action="index.php">
<select name="the_select">
<option selected="selected" id="default">Select an option</option>
<option id="1">option1</option>
<option id="2">option2</option>
</select>
<fieldset>
<legend>Controls</legend>
<button>Add</button>
<button>Remove</button>
</fieldset>
<table>
<tr>
<td>
Blah
</td>
<td>
bleh
</td>
</tr>
<tr>
<td>
Fizz
</td>
<td>
Buzz
</td>
</tr>
</table>
</form>

Table Within Div Firefox vs Chrome

So I am web developer who used to have a kind graphics design person help me out on this sort of browser compatibility hell, but alas he has moved on to greener pastures. The following html looks fine and dandy on chrome, but the table I am using to align my form is sleeping on the job on the bottom in ie and firefox. Should I never use tables? Is the float in the div tags screwing everything up? Any hints or suggestions for improving my html and css would be much appreciated.
Also, the text area text gets a little screwy sometimes in terms of where it is positioned in the box.
Thank you all.
<div style="border-style:solid; border-color:#336699; padding: 5px; margin-left:auto; margin-right:auto; width:600px; height:300px;" id="demoContainer">
<div style="" id="demo">
<div style="" id="demoHeader">
<img src="someimage" />
<span style="font-size:32px;">Demo</span>
</div>
<div style="" id="demoBody">
<form method="get">
<div style="float:left; padding:5px;" id="demoBodyText">
<textarea style="resize:none;" rows="10" cols="30">
Enter demo text here...
</textarea>
</div>
<div style="float:right; padding:5px;" id="demoBodyOptions">
<table style="float:right;">
<tr>
<th>
Option 1:
</th>
<td>
<select style="">
<option>asdf</option>
</select>
</td>
</tr>
<tr>
<th>
Option 2:
</th>
<td>
<select style="align:left;">
<option value="320">Fastest</option>
<option value="260">Faster</option>
<option value="200">Fast</option>
<option value="170" selected="selected">Default</option>
<option value="130">Slow</option>
<option value="110">Slower</option>
<option value="80">Slowest</option>
</select>
</td>
</tr>
<tr>
<th>
Option 3:
</th>
<td>
<select>
<option value="4.2">Highest</option>
<option value="3">Higher</option>
<option value="2">High</option>
<option value="1" selected>Default</option>
<option value="0.8">Low</option>
<option value="0.6">Lower</option>
<option value="0.4">Lowest</option>
</select style="align:left;">
</td>
</tr>
<tr>
<th>
Option 4
</th>
<td>
<select>
<option value="none">None</option>
</select style="align:left;" >
</td>
</tr>
<tr>
<td>
<input type="submit" />
</td>
</tr>
</table>
</div>
</form>
</div>
<div style="clear:both;" id="demoFooter">
Footer
</div>
</div>
</div>
EDIT: Added image in how it displays in my firefox version 10.
If you have a float:right after a float:left this seems pretty normal.
Try to switch the order of the two or give the second one also float:left
Or maybe the padding is the problem?
http://jsfiddle.net/HerrSerker/55cXT/
What are the width of your floated divs #demoBodyText and #demoBodyOptions?
See the fiddle - Is this you are looking for?
Fiddle: http://jsfiddle.net/jKtkq/
Demo: http://jsfiddle.net/jKtkq/embedded/result/
Screen shot: http://img39.imageshack.us/img39/7676/tableissue.jpg

HTML table Aligning and format

I have three columns in a table. 1st and 3rd column have plenty of rows. 2nd column has only row, but i want this row to be located in middle of table. I am not getting desired result.
<tr>
<td>
<div id="Usrs">
<select name="z" id="z" size="25" multiple="multiple" style="width: 200px">
<option>abc</option>
</select>
</div>
</td>
<td colspan="2" align="center" valign="middle">
Move
</td>
<td>
<div id="Usrs">
<select name="z" id="z" size="25" multiple="multiple" style="width: 200px">
<option>abc</option>
</select>
</div>
</td>
</tr>
Attached the image also. Help me where am I going wrong
Use "vertical-align:" instead of "valign:"
style="vertical-align: middle"
http://www.css4you.de/Texteigenschaften/vertical-align.html
Try to add a div or span tag, and mention the width and height in it.

html and css: aligning a select to the right edge of a table

Consider the following HTML snippet. The desired effect is to have a dropdown be positioned right above a table.
<!-- this is actually in a proper CSS class, not inline-->
<div style="float:left;
min-height:1px;
padding:15px 2% 20px;
position:relative;
width:96%;">
<form method="post">
<div style="float:right;display:inline;">Show Me:
<select id="ddNumRecords" name="ddNumRecords" onchange="this.form.submit();">
<option>30</option>
<option>50</option>
<option>100</option>
</select>
</div>
The above renders like this:
table and select float right http://www.imagechicken.com/uploads/1253124526051538700.png
Question: How can I write my CSS to achieve positioning like this mockup?
desired http://www.imagechicken.com/uploads/1253124791005327900.png
Add clear: both; to your table's CSS. This will clear the float of the div (with the dropdown) above it.
But why don't you just text-align: right; your div, then you don't have to mess with floats and inline divs. That should work as well.
One way would be to add absolute positioning to both divs.
or
Other way would be to use table. For example:
<table>
<tr><td>
<form method="post">
<div style="float:right;display:inline;">Show Me:
<select id="ddNumRecords" name="ddNumRecords" onchange="this.form.submit();">
<option>30</option>
<option>50</option>
<option>100</option>
</select>
</div>
</form>
</td></tr>
<tr><td>
<div>
<div style="float:left;
min-height:1px;
padding:15px 2% 20px;
position:relative;
width:96%;">
hello world
</div>
</td></tr>
</table>
or
Add one more div around the div that has float:right. For example:
<form method="post">
<div style="float:left; width:300px">
<div style="float:right;display:inline;">Show Me:
<select id="ddNumRecords" name="ddNumRecords" onchange="this.form.submit();">
<option>30</option>
<option>50</option>
<option>100</option>
</select>
</div>
</div>
<div>
<div style="float:left;
min-height:1px;
padding:15px 2% 20px;
position:relative;
width:96%;">
hello world
</div>
you could make another cell for the table
<table>
<tr>
<td colspan="2">
<div style="float:right;display:inline;">Show Me:
<select id="ddNumRecords" name="ddNumRecords" onchange="this.form.submit();">
<option>30</option>
<option>50</option>
<option>100</option>
</select>
</div>
</td
</tr>
<tr>
<td>table head</td>
<td>table head</td>
</tr>
<tr>
<td>content1</td>
<td>ontent2</td>
</tr>
<tr>
<td>content3</td>
<td>content4</td>
</tr>
</table>
this should work.. or you could use css. but this is the fastest way to do it:-? at least until you make/find some css. you could use float left on both divs