navigation
a webmaster learning community
     Home    Register     Search      Help      Login    
FrontPage Alternative
Sponsors

Shopping Cart Software
Ecommerce software integrated into Frontpage, Dreamweaver and Golive templates. No monthly fees and available in ASP and PHP versions.

Website Templates
We also have a wide selection of Dreamweaver, Expression Web and Frontpage templates as well as webmaster tools and CSS layouts.

Frontpage website templates
Creative Website Templates for FrontPage, Dreamweaver, Flash, SwishMax

Search Forums
 

Advanced search
Recent Posts

 Todays Posts
 Most Active posts
 Posts since last visit
 My Recent Posts
 Mark posts read

 

Unordered lists in columns

 
View related threads: (in this forum | in all forums)

Logged in as: Guest
Users viewing this topic: none
Printable Version 

All Forums >> Web Development >> Cascading Style Sheets >> Unordered lists in columns
Page: [1]
 
sticks464

 

Posts: 55
Joined: 10/16/2005
Status: offline

 
Unordered lists in columns - 10/25/2006 9:25:50   
I am looking for a way to put unordered list in columns with a subject header over each one. I want to use <div>s and not tables. Anyone know of an example I can look at?
It will look like a dropdown menu with the heading and dropdowns visible all the time.
Thanks Guys.
jaybee

 

Posts: 14191
Joined: 10/7/2003
From: Berkshire, UK
Status: offline

 
RE: Unordered lists in columns - 10/25/2006 9:35:29   
In your css put

.listdiv {float:left;border:1px solid;}


in the html put

<div class="listdiv">
<p>Listing 1 Header Text</p>
<ul>
<li>List Item 1</li>
<li>List Item 2</li>
<li>List Item 3</li>
<li>List Item 4</li>
<li>List Item 5</li>
<li>List Item 6</li>
</ul>
</div>
<div class="listdiv">
<p>Listing 2 Header Text</p>
<ul>
<li>List Item 1</li>
<li>List Item 2</li>
<li>List Item 3</li>
<li>List Item 4</li>
<li>List Item 5</li>
<li>List Item 6</li>
</ul>
</div>
<div class="listdiv">
<p>Listing 3 Header Text</p>
<ul>
<li>List Item 1</li>
<li>List Item 2</li>
<li>List Item 3</li>
<li>List Item 4</li>
<li>List Item 5</li>
<li>List Item 6</li>
</ul>
</div>


The above will give you 3 columns that float next to each other, each has a heading above the list and a border round it.

You'll need to add more styles to it maybe to get rid of the bullets and pad out the text so it doesn't hit the borders.

I've used paragraphs <p> for the headings but you could change those to h1 or h2 or whatever.

If you want them to stack instead of float next to each other, take out the float in the css.

As it stands it looks like this:


Thumbnail Image
:)

Attachment (1)

_____________________________

If it ain't broke..... fix it until it is.
:)

:)
GAWDS
Now where did I put that Doctype?

(in reply to sticks464)
sticks464

 

Posts: 55
Joined: 10/16/2005
Status: offline

 
RE: Unordered lists in columns - 10/25/2006 10:42:25   
Thanks jaybee, works good in IE but not so in FF. Here's my code, maybe a few hints as to what I have done wrong (not validated yet) that is making positioning so difficult on this one.
CSS
quote:

body {
margin:0;
padding:0;
font-family:Arial, Helvetica, sans-serif;
font-size:90%;
background-color:#33ccff;
}

a:link {
color: #fff;
background-color:#3cf;
text-decoration: underline;
}

a:hover {
color: #000;
background-color: #99ccff;
text-decoration: none;
}

#content {
margin-left:191px;
margin-right:50px;
}

#menu {
float:left;
width:191px;
height:500px;
background:url("../Graphics/navback.gif") no-repeat;
}

.header {
height:102px;
text-align:center;
margin:auto;
padding-top:20px;
padding-bottom:30px;
}

#navigation {
width:191px;
padding-top:10px;
}

#navigation ul
{
list-style-type: none;
padding: 0;
margin: 0;
}

#navigation ul li
{
margin-top: 6px;
}

#navigation ul li a
{
display: block;
width: 100px;
text-decoration: none;
color: #ffffcc;
font-weight:bold;
background: url("../Graphics/button-front.gif");
padding:3px 0;
text-align:center;
margin-left:30px;
}

#navigation ul li a:hover
{
color: #540020;
background-image: url("../Graphics/button-back.gif");
font-weight: bold;
text-decoration:none;
}

#extra {
position:absolute;
margin-top:500px;
width:181px;
height:430px;
background: url("../Graphics/background.gif");
background-repeat: repeat-y;
padding-left:10px;
padding-top:20px;
}

.warning {
border:6px ridge #12a;
text-align:left;
padding:10px;
margin:30px 100px 0 100px;
}

.textbox {
border:6px ridge #12a;
text-align:left;
padding:10px;
margin:0 100px;
}

h1 {
text-align:center;
}

h2 {
text-align:center;
}

.exit {
text-align:center;
}

#mainpicbox1 {
width:480px;
height:303px;
text-align:center;
margin:auto;
background:url("../Graphics/box-1.jpg") no-repeat;
}

#slidepicbox3 {
width:400px;
height:150px;
margin:auto;
text-align:center;
}

.free {
padding-top:50px;
color:#fff;
}

.somediv {
float:left;
width: 275px;
height:150px;
margin-top:30px;
margin-left:105px;
/*padding-left:100px;*/
border:1px solid #000;
}

.somediv .floatbox {
float: left;
width: 105px;
}

* html .somediv p { /* IE 3px jog hack*/
height: 1%;
}

.somediv p {
margin-top: 0;
margin-left: 110px;
font-size:90%;
}


.somediv1 {
float:right;
width: 275px;
height:150px;
margin-top:30px;
margin-left:5px;
margin-right:100px;
border:1px solid #000;
}

.somediv1 .floatbox {
float: left;
width: 105px;
}

* html .somediv1 p { /* IE 3px jog hack*/
height: 1%;
}

.somediv1 p {
margin-top: -150px;
margin-left: 110px;
font-size:90%;
}

.listdiv {
float:left;
margin-top:60px;
margin-left:150px;
}

.listdiv ul {
list-style-type: none;
padding: 0;
margin: 0;
}




html
quote:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Template 2</title>
<link href="CSS/gal.css" rel="stylesheet" type="text/css" />
</head>

<body>
<div id="wrapper">
<div id="menu">
<div id="extra"><img src="Graphics/leftside-banner.gif" alt="left banner" width="120" height="303" border="0" /></div>
<div id="navigation">
<ul>
<li><a href="#">Link</a></li>
<li><a href="#">Link</a></li>
<li><a href="#">Link</a></li>
<li><a href="#">Link</a></li>
</ul>

</div>

</div>
<div id="content">
<p class="header"><img src="Graphics/page_ banner.gif" alt="banner" /></p>
<p class="textbox">DESCRIPTION GOES HERE. Donec molestie. Sed aliquam sem ut arcu. Phasellus sollicitudin. Vestibulum condimentum facilisis nulla. In hac habitasse platea dictumst. Nulla nonummy. Cras quis libero. Cras venenatis. Aliquam posuere lobortis pede. Nullam fringilla urna id leo. Praesent aliquet pretium erat. Praesent non odio. Pellentesque a magna a mauris vulputate lacinia. </p>
<h1>Model of the Month</h1>

<div class="somediv">
<div class="floatbox">
<img border="0" src="Gallery info pic/catss01.jpg" alt="Cats photo" /></div>
<p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Donec molestie. Sed aliquam sem ut arcu. Phasellus sollicitudin. Vestibulum condimentum facilisis nulla.</p>
</div>
<div class="somediv1">
<div class="floatbox1">
<img border="0" src="Gallery info pic/miche001.jpg" alt="Michele's photo" /></div>
<p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Donec molestie. Sed aliquam sem ut arcu. Phasellus sollicitudin. Vestibulum condimentum facilisis nulla.</p>
</div>

</div>
</div>
<div class="listdiv">
<p>Title goes here</p>
<ul>
<li>Name</li>
<li>Name</li>
<li>Name</li>
<li>Name</li>
<li>Name</li>
<li>Name</li>
</ul>
</div>
<div class="listdiv">
<p>Title goes here</p>
<ul>
<li>Name</li>
<li>Name</li>
<li>Name</li>
<li>Name</li>
<li>Name</li>
<li>Name</li>
</ul>
</div>
<div class="listdiv">
<p>Title goes here</p>
<ul>
<li>Name</li>
<li>Name</li>
<li>Name</li>
<li>Name</li>
<li>Name</li>
<li>Name</li>
</ul>
</div>




</div>


</body>
</html>



Thanks

(in reply to jaybee)
Tailslide

 

Posts: 6292
Joined: 5/10/2005
From: Out here on the raggedy edge
Status: offline

 
RE: Unordered lists in columns - 10/25/2006 10:55:42   
Give the floated div a width and see if that helps. All floated items must have a specific width unless that item has an inherent width (like an image for instance).

_____________________________

"My strategy is so simple an idiot could have devised it"
Little Blue Plane Web Design | Blood, Sweat & Rust - A Land Rover restoration project

(in reply to sticks464)
jaybee

 

Posts: 14191
Joined: 10/7/2003
From: Berkshire, UK
Status: offline

 
RE: Unordered lists in columns - 10/25/2006 11:17:41   
Yes sorry, I assumed you'd put your own width on it to fit in with your page.

_____________________________

If it ain't broke..... fix it until it is.
:)

:)
GAWDS
Now where did I put that Doctype?

(in reply to Tailslide)
sticks464

 

Posts: 55
Joined: 10/16/2005
Status: offline

 
RE: Unordered lists in columns - 10/25/2006 11:34:29   
When I give .listdiv a specific width it stacks the on the page. That's why I posted my css and html because I think something I have or haven't done is effecting how the page displays in browsers. Maybe it's the positioning of my div's in the html or something I'm not seeing with the css.

(in reply to jaybee)
Tailslide

 

Posts: 6292
Joined: 5/10/2005
From: Out here on the raggedy edge
Status: offline

 
RE: Unordered lists in columns - 10/25/2006 11:43:06   
May be caused by giving the div too wide a div. Try around 200px.

It is normal float behaviour to wrap if there isn't enough room for the floats to sit next to each other either because the float themselves are too wide or because the overall page is fluid and ends up too narrow to fit the floats side by side.

_____________________________

"My strategy is so simple an idiot could have devised it"
Little Blue Plane Web Design | Blood, Sweat & Rust - A Land Rover restoration project

(in reply to sticks464)
sticks464

 

Posts: 55
Joined: 10/16/2005
Status: offline

 
RE: Unordered lists in columns - 10/25/2006 12:27:31   
Thanks Tail, that works ok with a width of 150px if I only use 2 ul's in the div. Each ul increases it's distance from the other when I use margin or padding to position them away from the left. In IE it positions away from the left of the page, in FF it positions away from the #extra on the left. That's why I think something is wrong with my code. But I'm only having these problems when I use a div for content. Would it help if I nested this div inside another and positioned it on the page? Then if I want my ul's to be closer together I can decrease the margin or padding.

(in reply to Tailslide)
Tailslide

 

Posts: 6292
Joined: 5/10/2005
From: Out here on the raggedy edge
Status: offline

 
RE: Unordered lists in columns - 10/25/2006 12:43:26   
Try to avoid using padding and margins together as you may run into problems with IE. Use margins only to space stuff out and it might be better.

There is an IE bug which doubles the width of margins of one div from another sometimes - if you run into this then add display:inline to the affected div. This can cause issues so only use it if you have to.

It may help you to nest the divs but I tend to try to avoid doing this as there's usually a way around it without adding the unecessary extra markup. You could look into using min-width on the main wrapper div to ensure the page doesn't go below a certain width (and cause the floats to wrap). This will only work in modern browsers - not IE6 though.

_____________________________

"My strategy is so simple an idiot could have devised it"
Little Blue Plane Web Design | Blood, Sweat & Rust - A Land Rover restoration project

(in reply to sticks464)
pmagas

 

Posts: 367
Joined: 3/26/2002
From: St. Louis MO USA
Status: offline

 
RE: Unordered lists in columns - 10/26/2006 18:25:45   
I think I might be doing what you're looking for in the re-design on my site. You can see a sample page here:
test page I think the navigation bar on the left might be what you're looking for. If so, let me know and I'll send you my css file and the include file I use for that menu.

(I'm using an include file for the menu so that when the menu changes, I don't have to update every page.)

Cheers!

_____________________________

Penny
humble webmaster of
We Sell St. Louis
http://www.WeSellStLouis.com
http://www.MarkSellsStLouis.net
http://www.St-Louis-Mo.info
http://www.NealSellsStLouis.com

(in reply to sticks464)
c1sissy

 

Posts: 5084
Joined: 7/20/2002
From: NJ
Status: offline

 
RE: Unordered lists in columns - 10/27/2006 14:39:13   
Nice job on the menu Penny, (sorry think Icalled you peggy before, apologize :))

I like how you have it set up.

_____________________________

Deb-aka-c4Ksissy
high panjandurum and alpha female of the silverback tribe
As decreed by Jesper 5-24-2003.
The only stupid question is... the one that is never asked!!
http://directory.css-styling.com
http://fmsforum.com
http://positioniseverything.net/
http://www.tanfa.co.uk/

(in reply to pmagas)
pmagas

 

Posts: 367
Joined: 3/26/2002
From: St. Louis MO USA
Status: offline

 
RE: Unordered lists in columns - 10/27/2006 14:58:07   
Thank you, Deb!! Now all I have to do is get the rest of the site going. :) I'm looking forward to having the site built in CSS - maybe it will be less than 6 years between designs now.

Cheers!

_____________________________

Penny
humble webmaster of
We Sell St. Louis
http://www.WeSellStLouis.com
http://www.MarkSellsStLouis.net
http://www.St-Louis-Mo.info
http://www.NealSellsStLouis.com

(in reply to c1sissy)
c1sissy

 

Posts: 5084
Joined: 7/20/2002
From: NJ
Status: offline

 
RE: Unordered lists in columns - 10/27/2006 15:00:23   
css is great, and i know you can do it!

_____________________________

Deb-aka-c4Ksissy
high panjandurum and alpha female of the silverback tribe
As decreed by Jesper 5-24-2003.
The only stupid question is... the one that is never asked!!
http://directory.css-styling.com
http://fmsforum.com
http://positioniseverything.net/
http://www.tanfa.co.uk/

(in reply to pmagas)
Page:   [1]

All Forums >> Web Development >> Cascading Style Sheets >> Unordered lists in columns
Page: [1]
Jump to: 1





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts