views:

1918

answers:

3

Hi,

I am trying to display images side by side using just css. The problem is that the images are not displaying inline but as a list (I am using the tag to accomplish this). Maybe I am using the wrong type of tag or my css is just wrong (see below):

ul { float: left; width: 15em; /* width is changed */ margin: 0; padding: 0; list-style-type: none; list-style-position: outside; } li { float: left; width: 100%; margin: 20%; }

I could use some help =)

A: 

Why not use span tags rather than ul/li? Using the list tags is probably why you're getting a list.

pjc50
span should not be used to do this.Maybe he wants to use a list because it is semanticly correct for his purpose.
Boris Guéry
A: 

are you trying to do this?

ul
 li  img 1 /li
 li  img 2 /li
/ul

if so, your css should be on the li element

li { display:block float:left padding: 0 margin: 0} 
ul { padding:0 margin 0;}
ryansstack
I need to clarify a bit.. my content is also dynamic.. not sure if that makes a difference
+2  A: 

try this:

ul.gallery {
   height:425px;
   width:200px;
   list-style-type: none;
}
ul.gallery li {
   border:1px solid #BBBBBB;
   float:right;
   height:50px;
   margin-right:7px;
   margin-top:7px;
   width:50px;
}

And the (x)html

<ul class="gallery">
    <li><img src="images/0001.jpg" /></li> 
    <li><img src="images/0001.jpg" /></li> 
    <li><img src="images/0001.jpg" /></li> 
    <li><img src="images/0001.jpg" /></li> 
    <li><img src="images/0001.jpg" /></li> 
    <li><img src="images/0001.jpg" /></li> 
    <li><img src="images/0001.jpg" /></li> 
    <li><img src="images/0001.jpg" /></li> 
    <li><img src="images/0001.jpg" /></li>
</ul>
Boris Guéry
I believe the author's problem stems from having the li width set to 100%. This should take care of that.
dmercer
Hi,My content is dynamic. Will this change this?Thanks in advance,Ray
What do you mean ?Even if your content is dynamic, it should fit to your needs.But if you want something more specific, you should give a piece of your code and more precisions on what you want to get and from what/where.
Boris Guéry
By the way, you can add as much images (tags) as you want to the html i provided.Just set your width/height to fit your needs.
Boris Guéry
Sorry about that... Here are some more detail.I am creating a simple list of images that ref another page. I wish to place my list of images side by side with the title of the location above it.ul.gallery {height:425px;width:200px;list-style-type: none;}ul.gallery li {border:1px solid #BBBBBB;float:right;height:50px;margin-right:7px;margin-top:7px;width:50px;}</style></head> <body> <h2>Header Here</h2><ul class="Gallery"><li>Link with image here</li></ul>
Here is the link to the page to see what the above code is doing... http://www.buzzworthytravel.com/WorldDestinations.aspx