473,669 Members | 2,385 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How do I line up checkboxes vertically beside an indented list?

I want to have a set of nested UL elements where every LI has a
checkbox associated with it, and the checkboxes are all lined up
vertically either to the left or the right of the list. In other
words, something like this (my apologies if you're not using a fixed-
width font):

x - Item 1
x - Item 1a
x - Item 1b
x - Item 2
x - Item 2a
x - Item 2a1

or,

- Item 1 x
- Item 1a x
- Item 1b x
- Item 2 x
- Item 2a x
- Item 2a1 x

I want each checkbox to be associated with its list element - in other
words, I don't want to have the list items all in one div, and the
checkboxes to be all in a separate div beside it, because then they
might not line up properly - the list wouldn't be as tall as the
checkboxes.

How could I go about doing this?

Aug 16 '07 #1
19 5203
Scripsit Brian Kendig:
I want to have a set of nested UL elements where every LI has a
checkbox associated with it, and the checkboxes are all lined up
vertically either to the left or the right of the list.
This might be a wrong approach, whatever the original problem was. I'd
suggest that you start with describing the original problem or goal and
illustrate your current approach with a URL. Basically, CSS is just about
optional styling, so before you even start considering CSS issues with a
page, you should have a page written, with valid and logical markup, so that
you naturally post the URL with your question.
In other
words, something like this (my apologies if you're not using a fixed-width
font):
No apology granted for the omission of a URL.
x - Item 1
x - Item 1a
x - Item 1b
x - Item 2
x - Item 2a
x - Item 2a1
That'll probably be confusing, with _both_ list bullets _and_ checkboxes. It
would (_if_ the approach as such is feasible) probably be better to suppress
the list bullets and let the checkboxes play their role too, in addition to
being input elements.
I want each checkbox to be associated with its list element - in other
words, I don't want to have the list items all in one div, and the
checkboxes to be all in a separate div beside it, because then they
might not line up properly - the list wouldn't be as tall as the
checkboxes.
Sorry, but that's too vague a description, and it's very difficult to see
what you have tried. The natural markup would have just ul, li, label, and
input elements and no div.

Vertical placement of checkboxes can be tricky, but is this about it, or
something else?

--
Jukka K. Korpela ("Yucca")
http://www.cs.tut.fi/~jkorpela/

Aug 17 '07 #2
I'd suggest that you start with describing the original problem or goal and
illustrate your current approach with a URL.
The original problem is that I have a hierarchy of items which need to
be able to be selected or deselected with checkboxes, and I want the
checkboxes lined up vertically for neatness.

Here is a URL to show what I'm trying to accomplish.

http://www.enchanter.net/listfoo.png
Aug 17 '07 #3
Brian Kendig <br***@enchante r.netwrites:
I'd suggest that you start with describing the original problem or goal and
illustrate your current approach with a URL.

The original problem is that I have a hierarchy of items which need to
be able to be selected or deselected with checkboxes, and I want the
checkboxes lined up vertically for neatness.
Do you really want that? Lined up on the right, if one of
the items is long, it can be hard to see which checkbox
corresponds to the other items. If on the left and the
depth of nesting of ULs is large, the same thing applies.
Here is a URL to show what I'm trying to accomplish.

http://www.enchanter.net/listfoo.png
You offer payment with pictures of £5 notes, too, I suppose?

--
Jón Fairbairn Jo***********@c l.cam.ac.uk

Aug 17 '07 #4
On Aug 17, 10:03 am, Jon Fairbairn <jon.fairba...@ cl.cam.ac.ukwro te:
Do you really want that? Lined up on the right, if one of
the items is long, it can be hard to see which checkbox
corresponds to the other items. If on the left and the
depth of nesting of ULs is large, the same thing applies.
I'll set the background of every other row to a different color to
avoid this.

I actually need to display four checkboxes for each row, so that the
user can see at a glance which areas of the application he has create,
read, update, and delete access on. You can see how putting four
checkboxes on each row, not lined up vertically, would be visual
chaos. But for the purposes of this example, one checkbox suffices.
You offer payment with pictures of £5 notes, too, I suppose?
If I knew how to do it in HTML and CSS, mate, then I wouldn't have
come here asking how to do it in HTML and CSS.
Aug 17 '07 #5
If you'd like to suggest a better approach, by the way, you're very
welcome.

The situation is that I have the entire web application represented by
a tree. An admin needs to be able to see and modify, for a given role,
exactly what areas of the application that user can use to create,
update, modify, or delete data.

I think the most straightforward approach is to display the
hierarchical site tree as nested UL elements and have four columns of
checkboxes lined up beside it. If you can think of something better,
I'm all ears.
Aug 17 '07 #6
Brian Kendig wrote:
If you'd like to suggest a better approach, by the way, you're very
welcome.
You who? Please quote in Usenet.
The situation is that I have the entire web application represented by
a tree. An admin needs to be able to see and modify, for a given role,
exactly what areas of the application that user can use to create,
update, modify, or delete data.
Okay.
>
I think the most straightforward approach is to display the
hierarchical site tree as nested UL elements and have four columns of
checkboxes lined up beside it. If you can think of something better,
I'm all ears.
Okay, but I did show one possible example in this thread

http://message-id.net/<c7************ **************@ NAXS.COM>

--
Take care,

Jonathan
-------------------
LITTLE WORKS STUDIO
http://www.LittleWorksStudio.com
Aug 17 '07 #7
Scripsit Brian Kendig:
If I knew how to do it in HTML and CSS, mate, then I wouldn't have
come here asking how to do it in HTML and CSS.
If you don't know how to do "it" in HTML, learn that first, before trying to
style it with CSS. Here "it" means the logical structure and corresponding
markup, as far as possible, with some realistic (though perhaps not quite
real) content. Ask in c.i.w.a.html or c.i.w.a.site-design if you need help
with that part. Include sufficient content to give an idea of what you are
really doing. (The picture does not really paint a picture. It looks like
deeply nested list with one-item sublists. Odd.)

Write down 100 times: CSS is for optional presentational suggestions.

--
Jukka K. Korpela ("Yucca")
http://www.cs.tut.fi/~jkorpela/

Aug 17 '07 #8
Rik
On Fri, 17 Aug 2007 20:08:56 +0200, Brian Kendig <br***@enchante r.net>
wrote:
On Aug 17, 12:28 pm, "Jonathan N. Little" <lws4...@centra lva.net>
wrote:
>Brian Kendig wrote:
If you'd like to suggest a better approach, by the way, you're very
welcome.

You who? Please quote in Usenet.

You may want to see if your newsreader will let you view Usenet posts
as a tree, so that it's easy to see which post mine was in reply to.
That post might not be there, learn more about usenet.
--
Rik Wasmus
Aug 17 '07 #9
On Aug 17, 2:01 pm, "Jukka K. Korpela" <jkorp...@cs.tu t.fiwrote:
If you don't know how to do "it" in HTML, learn that first, before trying to
style it with CSS.
I know how to lay out the content with the checkbox immediately beside
the LI text. I was looking for help on how to style it so that the
checkboxes are lined up vertically. If this was not clear from my
initial explanation, I apologize.
(The picture does not really paint a picture. It looks like
deeply nested list with one-item sublists. Odd.)
If you don't understand what I'm describing from my initial
explanation or my picture, then I honestly don't know how to describe
it any better. If you *do* know what I'm describing, then I would
appreciate an example from you on how you feel I should have initially
presented it.

And yes, the picture is odd, because I selected one small part of the
tree for illustrative purposes, and that part happens to only have one-
item sublists. The structure of the data I have to work with is not
part of the scope of my question.
Aug 17 '07 #10

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

Similar topics

2
5912
by: puzzled | last post by:
I am trying to use css to control the indentation within items in a list. I would like something that looks like this: Text of a paragraph goes here, leading to the following list: * list item 1 * list item 2 * and so on
10
26869
by: john T | last post by:
Is there anyway to vertically center a html table using css in such a way it does not alter the html table. When I tryied it just screws up.
11
11517
by: Jamie Jackson | last post by:
Two part question: 1) I'd like to do have nicely indented checkbox labels, even where wraps occur (for instance, the way <li> wrapping works). So, I'd like this (where "_" = checkbox): _ Apples are my favorite fruit _ Pomegranates are my favorite fruit _ Oranges are my favorite fruit
10
11454
by: Steve | last post by:
I'm not sure if I should be using tables here to structure the layout or if CSS is okay. I have a data entry form in which I have floated the labels to one side, and given them a specific width. With regular input such as textboxes, everything lines up fine. The problem I'm having is that I have an unordered list of checkboxes, and only the first item will line up with the label. The additional checkboxes and their labels end up being...
4
4451
by: Tmuld | last post by:
Hello, I have a page that needs to only show 1 record at a time - but there are many fields - I want to display it vertically instead of hornizonatlly. The headers will run vertically as well. Sort of like this
2
11232
by: deepa.ravikiran | last post by:
Hi, I am trying to create a ASPX page which will list items with a checkbox beside each. The user has to be able to select items using the checkbox to do some further processing. If I use a gridview control, the checkboxes are all disabled, and I find that I have to have a Edit button for each row, and after clicking the Edit button, the row check box gets enabled. Is there any way that I can use the Gridcontrol (or any other ASPX web
1
2271
by: StickMaker | last post by:
On my page at http://www.sticksite.com/grizzly/ I want all the images down the left side with the relevant text vertically centered beside each image. NO tables; CSS only. The only way I can get it now is to use a lot of BR html tags to add space under each text so that the next image and text are not "all over the page." Can anyone tell this css-beginner how to fix the page, please?
2
5625
by: Troels Thomsen | last post by:
Hello , When an exeption occurs in a IronPython executet script, and I print the sys.exc , i get something ugly like the example below. How can I get the fileName and line number? Thx in advance Troels
1
5380
by: Carl Johansson | last post by:
I have a virtual ListView (VirtualMode set to true). To make it more convenient for the users of the ListView to select its items, I've set the ListView's CheckBoxes property to true. However, in virtual mode no checkboxes appear. That is, when the View style is set to Details the text labels are indented to make room for checkboxes, but no checkboxes are displayed. Am I missing something? I think this ought to be as straight forward as...
0
8383
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,...
0
8894
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8803
jinu1996
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...
1
8587
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8658
tracyyun
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...
0
7407
agi2029
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...
0
5682
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();...
0
4206
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...
1
2792
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

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.