css display inline problem

8 replies
  • WEB DESIGN
  • |
I have a problem with the display:inline; css instruction. Below is the relevant css and html all to do with the same page. The #nav inline works ok, the .photo-item doesn't. I've tried changing sizes, tried the float option but can't get what I want.

You can see the #nav working but the photos not at Mike Hayes' Photographs.

Be grateful for any input.

Mike

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

#nav li
{
display: inline;
margin: 0;
padding: 0;
}

.item {
margin: 10px;
padding: 10px;
border-bottom: 2px solid green;
border-right: 2px solid green;
}

.item p {
margin: 20px;
}

.item li {
margin-bottom: 20px;
}

.photo-item {
font-size: small;
}

.photo-item ul {
list-style: none;
}

.photo-item li {
display: inline;
}

<div class='item'>

<div class='photo-item'>
<ul>
<li>
<A HREF='sp-1.html' TARGET='_blank'>
<IMG SRC='images/tspar-1.png' ALT='sparrows' WIDTH='75' HEIGHT='63'>
</A>
<P>
Where's my grub?
</li>
<li>
<A HREF='sp-2.html' TARGET='_blank'>
<IMG SRC='images/tspar-2.png' ALT='sparrows' WIDTH='75' HEIGHT='63'>
</A>
<P>
Mum on finals.
</li>
<li>
<A HREF='sp-3.html' TARGET='_blank'>
<IMG SRC='images/tspar-3.png' ALT='sparrows' WIDTH='75' HEIGHT='63'>
</A>
<P>
Are you ready?
</li>
<li>
<A HREF='sp-4.html' TARGET='_blank'>
<IMG SRC='images/tspar-4.png' ALT='sparrows' WIDTH='75' HEIGHT='63'>
</A>
<P>
Touchdown
</li>
<li>
<A HREF='sp-5.html' TARGET='_blank'>
<IMG SRC='images/tspar-5.png' ALT='sparrows' WIDTH='75' HEIGHT='63'>
</A>
<P>
Bon appetit
</li>
</ul>
</div>

</div>
#css #display #inline #problem
  • Profile picture of the author NathanielDeal
    Hi Mike, I don't think that the photos are in this file -> mike-hayes.com/phptest/images/ and that is why they aren't showing up. The css seems fine.

    Thanks
    {{ DiscussionBoard.errors[1955977].message }}
    • Profile picture of the author MikeHayes
      Hi,

      I know the photos aren't there. The point is, why are the #nav li's inline but the .photo-item li's are not. I've uploaded the 1st 3 img's by the way.

      Mike
      Signature

      * * * * My site * * * *
      * * * * My paintings * * * *

      {{ DiscussionBoard.errors[1956383].message }}
  • Profile picture of the author NathanielDeal
    Oh, my bad I misread your question.

    I think that the photos aren't lining up because of the <P> tag. Try adding the inline to the <P> tag as well.

    .photo-item p {display:inline;}

    Let me know if this works, thanks!
    {{ DiscussionBoard.errors[1957313].message }}
    • Profile picture of the author MikeHayes
      I tried it and it almost worked. It put the description next to the image, adding a hyphen in between, with the result being that the 3 li's overflowed to the next line/block. But thatnks anyway. I have solved it buy using <table>.

      Mike
      Signature

      * * * * My site * * * *
      * * * * My paintings * * * *

      {{ DiscussionBoard.errors[1960084].message }}
  • Profile picture of the author golusin
    Try putting

    .photo-item li {
    display: inline-block;
    }

    It should solve the problem...
    {{ DiscussionBoard.errors[1960226].message }}
    • Profile picture of the author MikeHayes
      Tried it but no go. Thanks anyway.
      Signature

      * * * * My site * * * *
      * * * * My paintings * * * *

      {{ DiscussionBoard.errors[1969674].message }}
    • Profile picture of the author TNHarleyRider
      Originally Posted by golusin View Post

      Try putting

      .photo-item li {
      display: inline-block;
      }

      It should solve the problem...
      Thank you, golusin. This solved a problem that I was having in Firefox.
      {{ DiscussionBoard.errors[2554272].message }}
  • Profile picture of the author NathanielDeal
    No problem, I'm glad you got it fixed!
    {{ DiscussionBoard.errors[1960287].message }}

Trending Topics