473,379 Members | 1,423 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,379 software developers and data experts.

Horizontally Aligned Buttons

Hi,

I have a DIV containing an unordered list and to the right of the list
I'd like to have a stack of three horizontally-aligned submit buttons -
is it possible to achieve this?

Thanks,

John
Jul 20 '05 #1
5 8175

"John Topley" <john@$NO_SPAM$topley.freeserve.co.uk> wrote in message
news:c4**********@news8.svr.pol.co.uk...
Hi,

I have a DIV containing an unordered list and to the right of the list
I'd like to have a stack of three horizontally-aligned submit buttons -
is it possible to achieve this?

Thanks,

John

Could you post your code or give a URL?

Without seeing your actual code, I'm only guessing here; you could try
floating the div to the left then your next element (containing the buttons
perhaps?) would appear to the right.

div#whatever {
float: left;
}
Jul 20 '05 #2
Jim Roberts wrote:
Could you post your code or give a URL?

Without seeing your actual code, I'm only guessing here; you could try
floating the div to the left then your next element (containing the
buttons perhaps?) would appear to the right.

div#whatever {
float: left;
}


Hello Jim. Here's the code:

<div id="whatever">
<h3>Variableset</h3>
<ul>
<li class="fieldheading">Name</li>
<li>&lt;No selection&gt;</li>
<li class="fieldheading">Description</li>
<li>&lt;No selection&gt;</li>
</ul>
<input type="submit" class="formbutton" value="Browse" />
<input type="submit" class="formbutton" value="Modify" />
<input type="submit" class="formbutton" value="Create" />
</div>

In the stylesheet, I have:

#whatever {
float: left;
width: auto;
}

#whatever h3 {
padding-left: 1em;
}

#whatever li {
list-style: none;
}

#whatever ul {
margin-left: 1em;
}

#whatever .formbutton {
margin-top: 1em;
margin-right: 1em;
margin-bottom: 1em;
}

--I tried adding a line break after each submit button and giving each
button its own class and setting positional properties for each class,
but it didn't work. Hmm, perhaps I need to contain the buttons in
another DIV?

Thanks,

John
Jul 20 '05 #3

"John Topley" wrote:
Hello Jim. Here's the code:
--I tried adding a line break after each submit button and giving each
button its own class and setting positional properties for each class,
but it didn't work. Hmm, perhaps I need to contain the buttons in
another DIV?

Thanks,

John


You should put the buttons outside the div. try this:

<h3>Variableset</h3>
<div id="whatever">
<ul>
<li class="fieldheading">Name</li>
<li>&lt;No selection&gt;</li>
<li class="fieldheading">Description</li>
<li>&lt;No selection&gt;</li>
</ul>
</div>
<input type="submit" class="formbutton" value="Browse" />
<input type="submit" class="formbutton" value="Modify" />
<input type="submit" class="formbutton" value="Create" />

I moved the h3 outside as well. Add this to your style sheet:

input {
width: 5em;
display: block;
}

The width you can change to your liking. This will cause the buttons to all
be the same width regardless of the text length...

The display:block will cause your input elements to display as blocks rather
than inline and they will stack on on top the other.

As far as putting your input elements in a div, that's your choice. That
would give you more control over positioning and other styles...

To get the same look across multiple browsers, you may have to fool around
with positioning and such.

regards,
Jim Roberts
Jul 20 '05 #4
I fooled around with it some more. It looked okay in IE but looked a little
funky in mozilla. This is better:

<h3>Variable sets</h3>
<div id="variable">
<li class="fieldheading">Name</li>
<li>&lt;No selection&gt;</li>
<li class="fieldheading">Description</li>
<li>&lt;No selection&gt;</li>
</div>
<div id="button">
<input type="submit" value="Browse" />
<input type="submit" value="Modify" />
<input type="submit" value="Create" />
</div>

stylesheet:

#variable{
float: left;
width: auto;
text-align:left;
margin-right: 2em
}

#whatever li {
list-style: none;
}

#button {
/*styles for the Buttons Div */
}

div#button input {
display: block;
width: 5em;
}

of course, you can edit the styles to suit your needs, but this should be a
good start.

Regards,
Jim Roberts
Jul 20 '05 #5
Jim Roberts wrote:
I fooled around with it some more. It looked okay in IE but looked a
little funky in mozilla. This is better:

(Snipped)

of course, you can edit the styles to suit your needs, but this
should be a good start.

Regards,
Jim Roberts


Thanks a lot Jim, that's great.

Regards,

John
Jul 20 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: shanti.miller | last post by:
I've got a grid that uses paging and displays a maximum of 10 records at a time. Sometimes the fields have a lot of data in them and the datagrid takes up way too much horizontal space. I've...
9
by: Spoon | last post by:
Hello everyone, As far as I understand, if I request a uint8_t buffer, it could be allocated anywhere. uint8_t *buf = new uint8_t By anywhere, I mean e.g. it could start at an odd address....
3
by: boien | last post by:
I have a div container that i have created now i just want to make sure that its horizontally centered in any browser and in any resolution, so that when ever its on 800x600 or 1280x1024 its STILL...
0
by: John Dalberg | last post by:
using VS 2005. I have an unordered list with list items which are displayed horizontally. Some of the list items have hyper links and some have checkboxes. The problem is that the...
29
by: K. Jennings | last post by:
I would like to get the result of malloc() such that it is aligned on a given boundary - 8, in this case. Assuming that sizeof(u64) is 8, will u64 *p = malloc(N) ; do the trick in general? ...
6
by: Francesco Moi | last post by:
Hi. I'd like to flip horizontally an image with JavaScript. Is it possible? Thank you very much.
3
by: cmrhema | last post by:
Hi I am new to html. I just did an online study of it. I have placed 4 buttons on asp.net 2005 I want to have it displayed one after the other horizantally but after a little span of time. Any...
15
by: shaanxxx | last post by:
why malloc (allocator) guarantees that address return by them will be aligned by 8 byte ( on 32bit machin ) or 16 byte (64 bit machin) ?
4
by: Asm23 | last post by:
Hi i'm using intel P4. when I write the statement like char *p=new char what's the p value, is it aligned by 4 bytes? that's is p%4==0? and, now I'm using the Intel SSE2 instruction to do...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.