Welcome to Dream.In.Code
Become an Expert!

Join 150,421 Programmers for FREE! Get instant access to thousands of experts, tutorials, code snippets, and more! There are 1,104 people online right now. Registration is fast and FREE... Join Now!




Problem with inline display

 
Reply to this topicStart new topic

Problem with inline display

wingz198
1 Apr, 2008 - 06:02 PM
Post #1

D.I.C Head
**

Joined: 14 Oct, 2005
Posts: 55


My Contributions
I'm trying to show a horizontal line of image/text combinations with a border around each one. For some reason, the orange border is not going around this content:
IPB Image

Here's the code for it:
CODE
        <div class="contentNotes">
            <img src="images/moviePosters/forgettingSarahMarshall.jpg"/>
            blahblahblah
        </div>
        <div class="contentNotes">
            <img src="images/moviePosters/leatherheads.jpg"/>
        </div>


and the stylesheet:
CODE
#upcomingMovies {
    position: absolute;
    top: 100px;
    border: 1px solid #5C5A57;
    font-size: 14px;
    font-weight: bold;
}

#upcomingMovies div {
    display: inline;
}

#upcomingMovies .contentNotes {
    font-size: 9px;
    max-width: 100px;
    border: 1px solid #DD961B;    
}


Before I did the inline, the border worked fine.
User is offlineProfile CardPM
+Quote Post

Martyr2
RE: Problem With Inline Display
1 Apr, 2008 - 08:04 PM
Post #2

Programming Theoretician
Group Icon

Joined: 18 Apr, 2007
Posts: 5,660



Thanked: 314 times
Expert In: C/C++, Java, VB, VB.NET, C#, PHP, Web Development, HTML & CSS, Javascript

My Contributions
Try removing the max-width attribute from your contentnotes css, then add a float: left and see if that fixes it for you.

Keep in mind that for elements to be wrapped around they must be floated and often times the container element has to be floated as well. This is part of the W3C standards which FF follows. You don't have to do this in IE because, as usual, they do their own thing over there in Redmond.

Hope this solves the problem. smile.gif
User is offlineProfile CardPM
+Quote Post

thehat
RE: Problem With Inline Display
2 Apr, 2008 - 01:28 AM
Post #3

D.I.C Head
Group Icon

Joined: 28 Feb, 2008
Posts: 217


Dream Kudos: 100
My Contributions
QUOTE(wingz198 @ 2 Apr, 2008 - 03:02 AM) *

Before I did the inline, the border worked fine.


That's what is causing your problem, you need to leave the divs as block level items. Remove the display:inline completely, and put in a left float like Martyr2 says.

User is offlineProfile CardPM
+Quote Post

wingz198
RE: Problem With Inline Display
2 Apr, 2008 - 08:17 AM
Post #4

D.I.C Head
**

Joined: 14 Oct, 2005
Posts: 55


My Contributions
Thanks, that fixed the border problem. Now I just need to have it show up in a horizontal row.
User is offlineProfile CardPM
+Quote Post

thehat
RE: Problem With Inline Display
2 Apr, 2008 - 08:39 AM
Post #5

D.I.C Head
Group Icon

Joined: 28 Feb, 2008
Posts: 217


Dream Kudos: 100
My Contributions
What do you mean by horizontal row? If you want the text to display alongside the images then disregard what I've said and follow Martyr2's instructions. If you wanted the text under the image, this is how to do it still using your max-width to wrap the text:

CODE

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>MoviePic Test</title>
<style type="text/css">
#upcomingMovies {
    position: absolute;
    top: 100px;
    border: 1px solid #5C5A57;
    font-size: 14px;
    font-weight: bold;
}

#upcomingMovies div {
    float:left;
}

#upcomingMovies .contentNotes {
    font-size: 9px;
    max-width: 100px;
    border: 1px solid #DD961B;    
}
</style>
</head>

<body>
<div id="upcomingMovies">
    <div class="contentNotes">
        <img src="images/fader1.jpg"/>
        blahblahblah
    </div>
    <div class="contentNotes">
        <img src="images/fader2.jpg"/>
        blahblahblah
    </div>
</div>
</body>
</html>


You can alternatively put the float:left; in the .contentNotes rules with the same effect.
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 1/9/09 08:23PM

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter

Live Help!

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month