Newbie :-Trouble aligning text within div tag

This is a discussion on "Newbie :-Trouble aligning text within div tag" within the Web Page Design section. This forum, and the thread "Newbie :-Trouble aligning text within div tag are both part of the Design Your Website category.



 Subscribe in a reader

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

Notices


Reply
 
LinkBack Thread Tools
  #1  
Old Nov 23rd, 2007, 06:43
New Member
Join Date: Sep 2007
Location: India
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Newbie :-Trouble aligning text within div tag

hi.
Following is the stylesheet part thats giving me trouble
Code: Select all
.author
{
background-image:url(Feather2.jpg);
background-repeat: no-repeat; 
background-attachment:fixed;
background-position: right bottom;
height:100px;
width:20%;
align:right;
vertical-align: bottom;
border:1px solid black;
}
I am using this as
HTML: Select all
<div class="author">by AUTHOR NAME</div>
The image is 103X100
the idea is to have a feather pic as background... and allow the author's name appear over the picture. and I want to have the text at the bottom-right corner .


Cant figure out what am i doing wrong here
Must be really simple and stupid.. that i must be missing.. but cant spot it
Please helpme
thanks in advance
Deepa
Attached Images
File Type: jpg Feather2.jpg (1.2 KB, 35 views)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote

  #2  
Old Nov 23rd, 2007, 06:52
Marc's Avatar
Staff Manager

SuperMember
Join Date: Apr 2007
Location: Scotland, UK
Posts: 1,765
Thanks: 0
Thanked 14 Times in 14 Posts
Re: Newbie :-Trouble aligning text within div tag

I don't think you can use the vertical-align attribute as that is mainly for tables. Can somebody please prove me wrong?

You will need to use the padding-top attribute and work out how much space there is from the top of the div - (100-font size+5)px. I don't know but that's how i would do it .
__________________
Marc
Staff Manager - Webforumz.com


Want to be a moderator? PM me.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #3  
Old Nov 23rd, 2007, 07:10
New Member
Join Date: Sep 2007
Location: India
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Newbie :-Trouble aligning text within div tag

Thanks marc for the quick response

..the bloc is just 20% wide
and i want the author name toi be displayed in bottom right coner...
would padding-top work with names that are both long and shot ? ?
There must be someway to do this....
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #4  
Old Nov 23rd, 2007, 12:55
Elite Veteran
Join Date: Sep 2006
Location: Pink House
Posts: 3,946
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Newbie :-Trouble aligning text within div tag

The closest I think you can come is something like this:
Code: Select all
.author
{
background-image:url(Feather2.jpg);
background-repeat: no-repeat; 
height:30px;
width:20%;
border:1px solid black;
text-align: right;
padding-top:70px;
}
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #5  
Old Nov 29th, 2007, 07:48
New Member
Join Date: Sep 2007
Location: India
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Newbie :-Trouble aligning text within div tag

Well, afer several trial and error.. i gaveup on css for this
I used table and gave teh feater as background for the cell ..
.. not happy.. but works

thanks guys for the response
Deepa
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #6  
Old Nov 29th, 2007, 07:57
Most Reputable Member
Join Date: Feb 2004
Location: Borneo
Age: 27
Posts: 1,611
Blog Entries: 2
Thanks: 0
Thanked 4 Times in 3 Posts
Re: Newbie :-Trouble aligning text within div tag

Table huh?? If you thinks it solved your entire problem, you are wrong. By using table, you will have loading problem (slow loading) compare if you just use css.

That's how everyone learn in here! Find a problem and beat the hell of it until they solved it!
We not encourage you to take the short easy way by using table for your layout.

Hope that encourage you
Cheers..
Last Blog Entry: ASP Programming Tips and Technique (Oct 26th, 2007)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #7  
Old Nov 29th, 2007, 08:00
New Member
Join Date: Sep 2007
Location: India
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Newbie :-Trouble aligning text within div tag

yes monie.. i know.. table is not a wise way to do
but this is a stopgap arrangement for me
.. for that matter.. i hate tables myself... i used css div at all times ...
but i am tottally exhaused.. i could not go any futher on this..
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #8  
Old Nov 29th, 2007, 08:52
welshstew's Avatar
Site Admin

SuperMember
Join Date: May 2007
Location: inside the outside
Posts: 1,691
Blog Entries: 14
Thanks: 3
Thanked 32 Times in 30 Posts
Re: Newbie :-Trouble aligning text within div tag

Deepa,

Never give up, take a few hours / days away from the problem then come back to it with fresh eyes. That seems to work for me.

Anyway, try the following, it seems to work for me in FF, IE7 an IE6 but you will need to test in Safari and Opera (if you are interested to see if it works across all browsers.

HTML: Select all
<!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=utf-8" />
<title>Untitled Document</title>
<style type="text/css">
#author{
background-image:url('Feather2.jpg');
background-repeat: no-repeat; 
background-position: right;
height:100px;
width:20%;
display:block;
border:1px solid black;
}
#author span {
float:right;
margin-top:80px;
}
</style>
</head>

<body>
<div id="author"><span>by AUTHOR NAME</span></div>
</body>
</html>
__________________
WelshStew Site Admin
If you think I've helped, click the "Thanks"
tierney rides tboard - uk site | xtreme wales - extreme clothing
WebForumz - facebook | LinkedIn
Last Blog Entry: Phorm approved for UK rollout (Sep 17th, 2008)

Last edited by welshstew; Nov 29th, 2007 at 08:57.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #9  
Old Nov 29th, 2007, 08:59
Reputable Member
Join Date: Jun 2007
Location: uk
Posts: 459
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Newbie :-Trouble aligning text within div tag

Have a look here.

http://www.the-art-of-web.com/css/textoverimage/

scroll down to CSS section.

Hope it helps.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Reply

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
CSS Aligning Wesley Web Page Design 15 Jan 20th, 2008 19:49
GD Aligning? PicoDeath PHP Forum 3 Aug 2nd, 2007 16:14
Vertically aligning text at the bottom Donny Bahama Web Page Design 6 Apr 16th, 2007 02:44
Text formatting trouble BGarner Web Page Design 4 Jan 8th, 2007 11:47
Formatting Text - XML newbie wants everything! AceTutor Other Programming Languages 0 Apr 28th, 2006 13:53


All times are GMT. The time now is 01:14.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization 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