Can <span></span> tags have position relative?

This is a discussion on "Can <span></span> tags have position relative?" within the Web Page Design section. This forum, and the thread "Can <span></span> tags have position relative? 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 Mar 8th, 2008, 19:02
Oak's Avatar
Oak Oak is offline
SuperMember

SuperMember
Join Date: Dec 2007
Location: London
Age: 35
Posts: 304
Thanks: 6
Thanked 0 Times in 0 Posts
Can <span></span> tags have position relative?

Can <span></span> tags have position relative?

I am trying to use this image replacement technique bellow. The problem is that when I minimize the browser window the image is set to a new position on my page. Would this also happen when someone with a different size monitor to mine views the page?

How can I stop this happening? I was thinking to use relative positioning.

HTML: Select all
<h1 id="header"><span></span>Key Words</h1>

#header {
    width: 220px;
    height: 57px;
    position: absolute; left: 285px; top:20px;
    }
#header span {
    background: url(img/logo4.jpg) no-repeat;
    position: absolute; left: 0px; top:0px;
    width: 220px;
    height: 57px;
    }
Cheers
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 Mar 8th, 2008, 19:04
Aso's Avatar
Aso Aso is online now
Moderator

SuperMember
Join Date: Oct 2007
Location: UK
Posts: 1,341
Blog Entries: 2
Thanks: 11
Thanked 49 Times in 46 Posts
Re: Can <span></span> tags have position relative?

Add
Code: Select all
display:block
to #header span and remove it's positioning (you've positioned #header so you don't need this).
Last Blog Entry: The Google Misconception (Feb 3rd, 2008)
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 Mar 8th, 2008, 19:14
Oak's Avatar
Oak Oak is offline
SuperMember

SuperMember
Join Date: Dec 2007
Location: London
Age: 35
Posts: 304
Thanks: 6
Thanked 0 Times in 0 Posts
Re: Can <span></span> tags have position relative?

Code: Select all
#header {
    width: 220px;
    height: 57px;
    position: absolute; left: 285px; top:20px;
    }
#header span {
    background: url(img/logo4.jpg) no-repeat;
    display:block;
    width: 220px;
    height: 57px;
    }
This set the <h1>text off place and the whole thing still moved when the page was minimized.
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 Mar 8th, 2008, 20:20
Oak's Avatar
Oak Oak is offline
SuperMember

SuperMember
Join Date: Dec 2007
Location: London
Age: 35
Posts: 304
Thanks: 6
Thanked 0 Times in 0 Posts
Re: Can <span></span> tags have position relative?

Have I missed something?
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 Mar 8th, 2008, 23:05
Aso's Avatar
Aso Aso is online now
Moderator

SuperMember
Join Date: Oct 2007
Location: UK
Posts: 1,341
Blog Entries: 2
Thanks: 11
Thanked 49 Times in 46 Posts
Re: Can <span></span> tags have position relative?

Apply the positioning to #header span instead of #header.
Last Blog Entry: The Google Misconception (Feb 3rd, 2008)
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 Mar 9th, 2008, 08:56
Oak's Avatar
Oak Oak is offline
SuperMember

SuperMember
Join Date: Dec 2007
Location: London
Age: 35
Posts: 304
Thanks: 6
Thanked 0 Times in 0 Posts
Re: Can <span></span> tags have position relative?

Code: Select all
#header {
    width: 220px;
    height: 57px;
    }
#header span {
    background: url(img/logo4.jpg) no-repeat;
    display:block;
    position: absolute; left: 285px; top:20px;
    width: 220px;
    height: 57px;
    }
This results in a white space going across the body. The logo/image replacement still positions in relation to page size.

You can see in the screen shots that, as I have left out the positioning of the #header, the <h1> text is no longer hidden by the image.

Attached screen shoots:

The second one is of the page minimized slightly.
Attached Images
File Type: jpg scrn-sht-imgrepl.jpg (74.1 KB, 3 views)
File Type: jpg scrsht-imgrepl2.jpg (73.7 KB, 3 views)

Last edited by Oak; Mar 9th, 2008 at 14:18.
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 Mar 9th, 2008, 13:17
Aso's Avatar
Aso Aso is online now
Moderator

SuperMember
Join Date: Oct 2007
Location: UK
Posts: 1,341
Blog Entries: 2
Thanks: 11
Thanked 49 Times in 46 Posts
Re: Can <span></span> tags have position relative?

Ok, I have not being paying attention! Sorry Oak, try this;
Code: Select all
#header {
      display:block;
      width: 220px;
      height: 57px;
      text-indent: -5000px;
      background: url(img/logo4.jpg) no-repeat;
      position: absolute;
      left: 285px;
      top:20px;
}
HTML: Select all
<h1 id="header">Key Words</h1>
Last Blog Entry: The Google Misconception (Feb 3rd, 2008)
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 Mar 9th, 2008, 14:28
Oak's Avatar
Oak Oak is offline
SuperMember

SuperMember
Join Date: Dec 2007
Location: London
Age: 35
Posts: 304
Thanks: 6
Thanked 0 Times in 0 Posts
Re: Can <span></span> tags have position relative?

So you have left out the span!

before
HTML: Select all
<h1 id="header"><span></span>Capoeira Canal</h1>
after

HTML: Select all
   <h1 id="header">Key Words</h1>
This is how it looks after trying your suggestion
Code: Select all
#header {
      display:block;
      width: 220px;
      height: 57px;
      text-indent: -5000px;
      background: url(img/logo4.jpg) no-repeat;
      position: absolute;
      left: 285px;
      top:20px;
}
#header span {
    background: url(img/logo4.jpg) no-repeat;
    position: absolute; left: 0px; top:0px;
    width: 220px;
    height: 57px;
    }
I also tried leaving out #header span.

This time the <h1> key words seem to be covered by the logo, which is what I want but the Logo still moves with screen size.
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 Mar 9th, 2008, 14:45
Aso's Avatar
Aso Aso is online now
Moderator

SuperMember
Join Date: Oct 2007
Location: UK
Posts: 1,341
Blog Entries: 2
Thanks: 11
Thanked 49 Times in 46 Posts
Re: Can <span></span> tags have position relative?

No, copy the code exactly as I have posted. Remove the span element and it's styles.
Last Blog Entry: The Google Misconception (Feb 3rd, 2008)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #10  
Old Mar 9th, 2008, 15:52
Oak's Avatar
Oak Oak is offline
SuperMember

SuperMember
Join Date: Dec 2007
Location: London
Age: 35
Posts: 304
Thanks: 6
Thanked 0 Times in 0 Posts
Re: Can <span></span> tags have position relative?

Quote:
No, copy the code exactly as I have posted. Remove the span element and it's styles.
Sorry, what I said wasn't clear, but yes I tried that. The image still moves with screen sive.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #11  
Old Mar 9th, 2008, 16:03
Aso's Avatar
Aso Aso is online now
Moderator

SuperMember
Join Date: Oct 2007
Location: UK
Posts: 1,341
Blog Entries: 2
Thanks: 11
Thanked 49 Times in 46 Posts
Re: Can <span></span> tags have position relative?

I'd have to see it for myself - you got a link?

If you want the header to move with your design, you'll need to contain it within another element, or use an alternative to position: absolute.
Last Blog Entry: The Google Misconception (Feb 3rd, 2008)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #12  
Old Mar 9th, 2008, 16:10
Oak's Avatar
Oak Oak is offline
SuperMember

SuperMember
Join Date: Dec 2007
Location: London
Age: 35
Posts: 304
Thanks: 6
Thanked 0 Times in 0 Posts
Re: Can <span></span> tags have position relative?

Quote:
I'd have to see it for myself - you got a link?

If you want the header to move with your design, you'll need to contain it within another element, or use an alternative to position: absolute.
Well that's what I ask in my first post, if I can use position relative.

http://www.capoeiracanal.co.uk/index-header.php

Last edited by Oak; Mar 9th, 2008 at 16:32.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #13  
Old Mar 9th, 2008, 16:35
Aso's Avatar
Aso Aso is online now
Moderator

SuperMember
Join Date: Oct 2007
Location: UK
Posts: 1,341
Blog Entries: 2
Thanks: 11
Thanked 49 Times in 46 Posts
Re: Can <span></span> tags have position relative?

Set #maincontent to position:relative.

This means you can then position the h1 absolutely, relative to the maincontent div
Last Blog Entry: The Google Misconception (Feb 3rd, 2008)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #14  
Old Mar 9th, 2008, 17:04
Oak's Avatar
Oak Oak is offline
SuperMember

SuperMember
Join Date: Dec 2007
Location: London
Age: 35
Posts: 304
Thanks: 6
Thanked 0 Times in 0 Posts
Re: Can <span></span> tags have position relative?

aso186, you are a genius, thanks.

This works and permits me to use the original code the only thing now is that key words fall on the same line as the Nav bar text when viewing the page with images turned off.

Thanks for your help, I could not have done that on my own!
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
From table tags to div and span abdoukadri Web Page Design 6 Dec 5th, 2007 22:57
<SPAN> help Access JavaScript Forum 2 Nov 3rd, 2007 18:13
Div and Span tags... jjgamepro17 Web Page Design 4 Nov 7th, 2006 19:22
Span questions maxelcat Web Page Design 2 Aug 7th, 2006 11:07
Wrapping by span hessodreamy Web Page Design 3 Sep 14th, 2005 07:34


All times are GMT. The time now is 17:52.


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