thumbnail and text next to each other

This is a discussion on "thumbnail and text next to each other" within the Web Page Design section. This forum, and the thread "thumbnail and text next to each other are both part of the Design Your Website category.



Go Back   Webforumz.com > Main Forums > Design Your Website > Web Page Design

Notices


Reply
 
LinkBack Thread Tools
  #1 (permalink)  
Old Jul 1st, 2007, 15:25
konnor5092's Avatar
SuperMember

SuperMember
Join Date: Feb 2007
Location: Norwich, UK
Age: 23
Posts: 74
Thanks: 0
Thanked 0 Times in 0 Posts
thumbnail and text next to each other

I have this looking how I would like, but it doesn't strike me as being the most efficient code. Just wondered whether it could be cleaned up further.

I have a small thumbnail on the left, with text on the right..



Code: Select all
<div id="bio">
    <img src="images/steve.jpg" alt="steve" class="image_float" />
    <p><font color="#ffffff"><b>Steve: </b></font>Bass<br />Bio</p>
</div>   
<div id="bio">
    <img src="images/steve.jpg" alt="steve" class="image_float" />
    <p><font color="#ffffff"><b>Rob: </b></font>Lead Guitar<br />Bio</p>
</div>
<div id="bio">
    <img src="images/steve.jpg" alt="steve" class="image_float" />
    <p><font color="#ffffff"><b>Roger: </b></font>Vocals<br />Bio</p>
</div>
<div id="bio">
    <img src="images/steve.jpg" alt="steve" class="image_float" />
    <p><font color="#ffffff"><b>Trevor: </b></font>Drums<br />Bio</p>
</div>
Code: Select all
#bio {
    clear:both;
}

#bio p {
    padding-top: 5px;
    padding-left: 2px;
}

.image_float {
    margin-top: 2px;
    margin-left: 3px;
    float: left;
}
Many Thanks,
Reply With Quote

  #2 (permalink)  
Old Jul 1st, 2007, 15:54
Reputable Member
Join Date: Jun 2007
Location: UK
Age: 29
Posts: 172
Thanks: 0
Thanked 0 Times in 0 Posts
Re: thumbnail and text next to each other

I would get rid of the font tags and just style the text in the css eg

#bio p {
padding-top: 5px;
padding-left: 2px;
color:#fff;
font-weight:bold;
}
Reply With Quote
  #3 (permalink)  
Old Jul 1st, 2007, 16:02
konnor5092's Avatar
SuperMember

SuperMember
Join Date: Feb 2007
Location: Norwich, UK
Age: 23
Posts: 74
Thanks: 0
Thanked 0 Times in 0 Posts
Re: thumbnail and text next to each other

If I want two different colours and one word bold in the same line don't I need it in the HTML?
Reply With Quote
  #4 (permalink)  
Old Jul 1st, 2007, 16:24
SuperMember

SuperMember
Join Date: May 2006
Location: North West, UK
Age: 22
Posts: 1,173
Thanks: 0
Thanked 0 Times in 0 Posts
Re: thumbnail and text next to each other

That should be a list. You can use a ul. Any presentational code should be in the CSS so get rid of the font elements and change the <b> to <strong>, the same eeffect but it has more meaning. If you want to apply a colour or anything to just a word or few words then use the span element. Like this:

Code: Select all
<p>I am <span class="name">Steve</span> and I like <span class="interest">Music</span>.</p>
Then CSS:
Code: Select all
span.name {
color: red;
}

span.interest {
color: blue;
}
Make sure you give spans a class or id as you will often use a few in a page and you don't want them to conflict.

Pete.

Last edited by pa007; Jul 1st, 2007 at 16:25. Reason: spelling mistakes in the css, oops!
Reply With Quote
  #5 (permalink)  
Old Jul 1st, 2007, 16:45
konnor5092's Avatar
SuperMember

SuperMember
Join Date: Feb 2007
Location: Norwich, UK
Age: 23
Posts: 74
Thanks: 0
Thanked 0 Times in 0 Posts
Re: thumbnail and text next to each other

thanks once again.

Use the same style for just one thumbnail and text on the page?

Reply With Quote
  #6 (permalink)  
Old Jul 1st, 2007, 17:09
Up'n'Coming Member
Join Date: Jun 2007
Location: Birmingham, UK
Posts: 54
Thanks: 0
Thanked 0 Times in 0 Posts
Re: thumbnail and text next to each other

I see another problem with your code. Instead of using id="bio" for all the div's you should consider using classes. The reason for this is that id's should be unique across a page, i.e. there should always be only one element with a given id.
Reply With Quote
  #7 (permalink)  
Old Jul 1st, 2007, 17:41
SuperMember

SuperMember
Join Date: May 2006
Location: North West, UK
Age: 22
Posts: 1,173
Thanks: 0
Thanked 0 Times in 0 Posts
Re: thumbnail and text next to each other

I'd do something like this:

HTML:
Code: Select all
<ul>
<li><img src="img1.jpg" /><h3>Steve: </h3> Bass <span>Bio</span></li>
<li><img src="img2.jpg" /><h3>Rob: </h3> Lead Guitar <span>Bio</span></li>
<li><img src="img3.jpg" /><h3>Roger: </h3> Vocals <span>Bio</span></li>
<li><img src="img4.jpg" /><h3>Trevor: </h3> Drums <span>Bio</span></li>
</ul>
CSS:
Code: Select all
ul {
    list-style: none;
}

ul li {
    clear: left;
    color: orange;
}

ul li img {
    float: left;
    width: 100px;
    height: 100px;  
    border: none;
}

ul li h3 {
    display: inline;
    color: #fff;
}

ul li span {
    display: block;
}
You see how simple the html is. We do most of the work in the css. I've used h3's but that depends, you might use h2's if you haven't already got any. It just lets us know that they are headers of some kind. Unfortunately heading elements or block level elements which means they appear on their own seperate line so we need to turn them into an inline element if we want text to appear next to them. The span with display: block; applied just makes sure that the bio bit apears on a seperate line. We clear: left; the li's to make sure each one is on it's own line. You would obviously change the width and height to the correct size. Add text and margin/padding as you would normally.

Hope that's works for you.

Pete.

Last edited by pa007; Jul 1st, 2007 at 21:06.
Reply With Quote
  #8 (permalink)  
Old Jul 1st, 2007, 18:00
New Member
Join Date: Jun 2007
Location: LoveLand
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Re: thumbnail and text next to each other

Nice and good solution Pete..
We just sometimes make things harder for ourself, I read somewhere there are 2000+ ways to write html/css
Reply With Quote
  #9 (permalink)  
Old Jul 1st, 2007, 18:05
SuperMember

SuperMember
Join Date: May 2006
Location: North West, UK
Age: 22
Posts: 1,173
Thanks: 0
Thanked 0 Times in 0 Posts
Re: thumbnail and text next to each other

It wouldn't suprise me. It's great because that means you can do so much with it but it's a pain because finding the right solution can be tricky sometimes. It's fun though, I like the problem solving-side of coding the best.

Pete.
Reply With Quote
  #10 (permalink)  
Old Jul 1st, 2007, 18:50
konnor5092's Avatar
SuperMember

SuperMember
Join Date: Feb 2007
Location: Norwich, UK
Age: 23
Posts: 74
Thanks: 0
Thanked 0 Times in 0 Posts
Re: thumbnail and text next to each other

Cheers mate. I'm edging closer to that Donate button!

How would you layout my second screen shot above with just the one thumbnail and the text around it and below?
Reply With Quote
  #11 (permalink)  
Old Jul 1st, 2007, 19:48
New Member
Join Date: Jun 2007
Location: LoveLand
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Re: thumbnail and text next to each other

Yah thats good that there are several ways to do one thing, this helps alot when we develop something that is dynamic & cross-browser..

Quote:
Originally Posted by pa007 View Post
It wouldn't suprise me. It's great because that means you can do so much with it but it's a pain because finding the right solution can be tricky sometimes. It's fun though, I like the problem solving-side of coding the best.

Pete.
Reply With Quote
  #12 (permalink)  
Old Jul 1st, 2007, 21:04
SuperMember

SuperMember
Join Date: May 2006
Location: North West, UK
Age: 22
Posts: 1,173
Thanks: 0
Thanked 0 Times in 0 Posts
Re: thumbnail and text next to each other

How many of these would you have on each page? Would it be one band member per page or would all of the bio's be on a single page?

Pete.
Reply With Quote
  #13 (permalink)  
Old Jul 1st, 2007, 21:39
konnor5092's Avatar
SuperMember

SuperMember
Join Date: Feb 2007
Location: Norwich, UK
Age: 23
Posts: 74
Thanks: 0
Thanked 0 Times in 0 Posts
Re: thumbnail and text next to each other

One small image in the top left per page, the rest text wrapped around the image and below.

Just float the image left?
Reply With Quote
  #14 (permalink)  
Old Jul 1st, 2007, 21:42
SuperMember

SuperMember
Join Date: May 2006
Location: North West, UK
Age: 22
Posts: 1,173
Thanks: 0
Thanked 0 Times in 0 Posts
Re: thumbnail and text next to each other

This works and I think it is pretty good. Someone will have to help me here. Does an image element have to be wrapped with anything other than a div or is it ok just sitting there? In this example it is within a div but nothing else, is that ok?

HTML:
Code: Select all
<div id="bio_main">
<img src="img1.jpg" alt="" /><h2>Steve: <span>Bass</span></h2> 
<p>BIO</p>
<p class="clear">Lorem ipsum dolor sit amet, consectetuer             adipiscing elit. Donec mattis, nulla ut auctor convallis, est urna tempor purus, eu congue dui augue vitae risus. Nunc faucibus placerat pede. Sed eu.</p>
</div>
CSS:
Code: Select all
div#bio_main img {
    float: left;
    width: 100px;
    height: 100px;    
}

div#bio_main h2 span {
    font-weight: normal;
    color: orange;
}

div#bio_main p.clear {
    clear: left;
}
Again play with the margin etc. to get the look you want. This should work fine, just waiting for feedback on the placement of the img tag issue.

If there is more than one band member on each page a list might be more appropriate. That will be more difficult to implement so give me a shout if that's the case.

Pete.
Reply With Quote
  #15 (permalink)  
Old Jul 1st, 2007, 23:03
SuperMember

SuperMember
Join Date: Sep 2006
Location: Pink House
Posts: 3,946
Thanks: 0
Thanked 0 Times in 0 Posts
Re: thumbnail and text next to each other

I typically will have a div class as my container.

Inside the div class I will float an image left.
I will also add a margin-right and a margin-bottom so that my text does not touch the image.
Then I add <p>'s and put my text in.
The text will wrap around without touching the image.
Reply With Quote
  #16 (permalink)  
Old Jul 2nd, 2007, 11:51
konnor5092's Avatar
SuperMember

SuperMember
Join Date: Feb 2007
Location: Norwich, UK
Age: 23
Posts: 74
Thanks: 0
Thanked 0 Times in 0 Posts
Re: thumbnail and text next to each other

Looks grand. Thanks for your help chaps.
Reply With Quote
Reply

Tags
float, layout, text, thumbnail

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to make a thumbnail using javascript? FXDesigns JavaScript Forum 7 Jan 21st, 2008 01:58
Help with Thumbnail popup windows cjrollo Flash & Multimedia Forum 6 Dec 7th, 2007 13:59
HELP - IE7 Thumbnail Images on a tab ActionPart Web Page Design 2 Jul 15th, 2007 13:00
Scrolling thumbnail Dan Oliver Flash & Multimedia Forum 1 Jun 6th, 2007 16:22
How does one make thumbnail images? Picard Website Planning 3 Dec 29th, 2006 13:34


All times are GMT. The time now is 05:08.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43