specifcy number of displayed list items of <ul>

Victor Kimura
Victor Kimura used Ask the Experts™
on
Hi,

I'm wondering if I have, say, a list of the 50 states of America in a <ul> and only wish to display, say, 10 before a user has to scroll then what is the attribute. I was looking for the <ul> attribute and I think I remember seeing is somewhere but I forgot.

Thanks,
Victor
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Top Expert 2015
Commented:
Do you mean a dropdown box?

http://lab.artlung.com/50states/
programmer
Commented:
Victor,
If you are talking about a scrolable list so someone can select a state from a list, try looking at the "size" element of the <select> tag. Something like:

<SELECT NAME='STATE' SIZE='5'>
  <OPTION VALUE='AL'>AL</OPTION>
  <OPTION VALUE='AK'>AK</OPTION>
  <OPTION VALUE='AZ'>AZ</OPTION>
  <OPTION VALUE='AR'>AR</OPTION>
  <OPTION VALUE='CA'>CA</OPTION>
  <OPTION VALUE='CO'>CO</OPTION>
  <OPTION VALUE='CT'>CT</OPTION>
      .
      .
      .
</SELECT>
Hope this is useful. If not, please clarify what you are trying to do.
George
Commented:
I don't think there is a ul attribute per se, but you can do it with css like this:

<!DOCTYPE html>
<html lang="en">
	<head>
		<style>
			ul.thelist{height:200px;width:150px;overflow:scroll;}
		</style>
		<title>Test</title>
	</head>
	<body>
		<ul class="thelist">
			<li>1</li>
			<li>2</li>
			<li>3</li>
			<li>4</li>
			<li>5</li>
			<li>6</li>
			<li>7</li>
			<li>8</li>
			<li>9</li>
			<li>10</li>
			<li>11</li>
			<li>12</li>
			<li>13</li>
			<li>14</li>
			<li>15</li>
			<li>16</li>
			<li>17</li>
			<li>18</li>
			<li>19</li>
			<li>20</li>
		</ul>
	</body>
</html>

Open in new window

Victor KimuraSEO, Web Developer

Author

Commented:
Thank you. That was helpful.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial