Solved

Horizontally aligned element container in HTML

Posted on 2008-10-30
5
292 Views
Last Modified: 2013-11-11
Hi Experts,

I want to realize HBOX component of FLex in HTML with the Help of CSS and javascript.

HBOX component  of Flex keeps all the innner components placed one after another horizontally and if the total width of the inner components exceeds HBOX then a scroll appears but in any case it will not put child elements vertically one after another.

If you want to see how HBOX looks then please follow the link below

http://examples.adobe.com/flex3/componentexplorer/explorer.html

and in navigate through Navigation panel as mentioned below

Visual Components --> Containers --> HBOX

I hope there would be solution for this question

thanks In advanse

0
Comment
Question by:Techfunda248
  • 3
  • 2
5 Comments
 
LVL 2

Expert Comment

by:BobTheViolent
ID: 22843244
If I understand your question, you may want to try a simple CSS nowrap command in a div or table as in the examples.

<div style="white-space:nowrap;">
 
 (Put buttons links and text in here)
 
</div>
 
<table style="white-space:nowrap;">
 <tr>
  <td>
 
  (Put buttons links and text in here)
 
  </td>
 </tr>
</table>

Open in new window

0
 

Author Comment

by:Techfunda248
ID: 22847176
Thanks BobTheViolent for you quick response, but I am sorry to say it could not provide any help.

Actually I want to have something like TABLE ROW effect. Where you goon adding elements ("<td>") and they placed in a line.Please  note that, I want  HTML ELEMENTS ( and notjust   text) to be wrapped in a line.

Hope that it will clear what i am looking for.  Thanks!
0
 
LVL 2

Accepted Solution

by:
BobTheViolent earned 500 total points
ID: 22851240
Sorry that didn't work like you wanted.  I'm still a little unsure what exactly you are looking for.

How about this example?  I replicated the HBox as closely as I could with basic HTML and CSS.

I tested in both IE 7 and FF 3, and get the same basic look as the hbox.


Try this:

<html>
	<body>
		<div style="border: 1px solid black; width: 75%; height: 100px; overflow: auto; padding:10"
			<label style="color:blue;font-family:arial;font-size:12">An HBox clone example horizontally aligned</label><br><br>
				<table style="border-width:1px; border-style:solid; padding:10">
					<tr>
						<td>
							<input type="button" value="test button">
						</td>
						<td>
							<input type="button" value="test button">
						</td>
						<td>
							<input type="button" value="test button">
						</td>
						<td>
							<input type="button" value="test button">
						</td>
						<td>
							<input type="button" value="test button">
						</td>
						<td>
							<input type="button" value="test button">
						</td>
						<td>
							<input type="button" value="test button">
						</td>
						<td>
							<input type="button" value="test button">
						</td>
						<td>
							<input type="button" value="test button">
						</td>
						<td>
							<input type="button" value="test button">
						</td>
						<td>
							<input type="button" value="test button">
						</td>
						<td>
							<select name="test">
							<option value="1">One</option>
							<option value="2">Two</option>
							<option value="3">Three</option>
							<option value="4">Four</option>
							</select>
						</td>
					</tr>
				</table>
		</div>
	</body>
</html>

Open in new window

0
 

Author Comment

by:Techfunda248
ID: 22876838

BobTheViolent: I think this is the only possible way left. Actually I wanted to use DIV & CSS only and not table to make something like this. But it seems that is the only way left out.
Anyways, Thanks a lot for you kind help.  And more Importantly I am going to accept your solution right now, but if by any chance you get hit by some idea to do it with DIV and CSS then do let me know.
0
 
LVL 2

Expert Comment

by:BobTheViolent
ID: 22878412
Techfunda248,

  Thank you for the points.  I messed around with it a little more and you actually CAN eliminate tables and go only DIV / CSS but it looks a slightly different, see what you think about this.

<html>
<body>
<div style="border: 1px solid black; width: 75%; height: 100px; overflow: auto; padding:10;white-space:nowrap"
<label style="color:blue;font-family:arial;font-size:12">An HBox clone example horizontally aligned</label><br><br>
<INPUT type="button" value="Refresh" onClick="window.location.reload()">
<input type="button" value="test button">
<input type="button" value="test button">
<input type="button" value="test button">
<input type="button" value="test button">
<input type="button" value="test button">
<input type="button" value="test button">
<input type="button" value="test button">
<input type="button" value="test button">
<input type="button" value="test button">
<input type="button" value="test button">
<input type="button" value="test button">
<input type="button" value="test button">
<input type="button" value="test button">
<input type="button" value="test button">
<input type="button" value="test button">
<select name="test">
<option value="1">One</option>
<option value="2">Two</option>
<option value="3">Three</option>
<option value="4">Four</option>
</select>
</div>
</body>
</html>

Open in new window

0

Featured Post

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Increase the size of the modal in Bootstrap 5 22
Javascript_Set_dropdown_value 7 31
Sort Order Icons on HTML Table 3 20
asp.net mvc5 6 12
This is a how to build your own CSS3 slideshow and when I say CSS3 I mean just CSS with no javascript in sight! There a few examples online of how to do this but most just show you an example without any explanation, others make it more complicat…
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
In this Micro Tutorial viewers will learn how to create a CSS image sprite (In a later tutorial, viewers will learn how to use CSS and HTML to create a navigation menu using this sprite) Open a new Photoshop document with a width of (Icon width)x(N…
The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…

813 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now