Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Positioning Links within a TH tag

 
Steve Dyke
Ranch Hand
Posts: 1616
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is it possible to have two links in a th tag, one positioned in the center and on to the extreem right?
 
Steve Dyke
Ranch Hand
Posts: 1616
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have tried floating one div tag inside another but if the parent div tag has contents the inserted div tag will not position itself on the same line as the content of the parent as I would like it too.

I need on line that has the text 'Message Center' centered then on the right end of this same line an icon that will expand and colapse the message content div container.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64631
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is the item you are floating first?
 
Steve Dyke
Ranch Hand
Posts: 1616
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bear Bibeault wrote:Is the item you are floating first?


Sorry it has taken so long to get back to this.

Yes my floated item is first. The following places the 'Message Center' text to the left of the container. I can get it closer to the center by making the width of the inner container 95% but when the page is scaled the outer container goes to two lines.



My CSS:

 
Rob Crowther
author
Ranch Hand
Posts: 297
5
Android Fedora Firefox Browser
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You've set the item you want to centre as float: left, it shouldn't be too surprising to you that it's not centred?
 
Steve Dyke
Ranch Hand
Posts: 1616
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Rob Crowther wrote:You've set the item you want to centre as float: left, it shouldn't be too surprising to you that it's not centred?


I have tried taking out the float: left and according to documents I have read the margin: 0 auto should center the container within the container but not successful so far.
 
Rob Crowther
author
Ranch Hand
Posts: 297
5
Android Fedora Firefox Browser
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is this what you're trying to do?





I had to replace your icon in the fiddle, so I picked one at random from this page. I also simplified your markup - couldn't see the point of having the <a> elements that didn't link anywhere, and the extra wrapper elements were serving no purpose either. Could be in the full version of your code they have a purpose, but in the code you posted they're just getting in your way. Also ridiculously long IDs are one of my pet hates, and you should avoid using them just as CSS hooks. Your class names also make the mistake of describing the style rather than the semantics - what are you going to do when a future revision means that your redItalicSmallBold class has to have large, blue underlined text?
 
Steve Dyke
Ranch Hand
Posts: 1616
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Rob Crowther wrote:Is this what you're trying to do?





I had to replace your icon in the fiddle, so I picked one at random from this page. I also simplified your markup - couldn't see the point of having the <a> elements that didn't link anywhere, and the extra wrapper elements were serving no purpose either. Could be in the full version of your code they have a purpose, but in the code you posted they're just getting in your way. Also ridiculously long IDs are one of my pet hates, and you should avoid using them just as CSS hooks. Your class names also make the mistake of describing the style rather than the semantics - what are you going to do when a future revision means that your redItalicSmallBold class has to have large, blue underlined text?


This still puts the text 'Message Center' on one line and the icon on second line.
 
Rob Crowther
author
Ranch Hand
Posts: 297
5
Android Fedora Firefox Browser
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No, it doesn't.

 
Steve Dyke
Ranch Hand
Posts: 1616
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Rob Crowther wrote:No, it doesn't.



Is there a way to send you a screen shot of my page?
 
Rob Crowther
author
Ranch Hand
Posts: 297
5
Android Fedora Firefox Browser
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm not sure how that would help, it's your code which needs fixing? I've posted working code based on the code you provided, how is your code different to that?

Also, you don't need to quote my entire comment every time, we can all see what I said already without you repeating it.
 
Steve Dyke
Ranch Hand
Posts: 1616
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Rob Crowther wrote:I'm not sure how that would help, it's your code which needs fixing? I've posted working code based on the code you provided, how is your code different to that?

Also, you don't need to quote my entire comment every time, we can all see what I said already without you repeating it.


Thanks for your help. I have been wrestleing with my log on page for the last 12 hours. Hate to be a bother to you.
 
Steve Dyke
Ranch Hand
Posts: 1616
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Rob Crowther wrote:No, it doesn't.



If I open the page in FireFox it is on one line but in IE8 it is on two lines.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64631
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Something doesn't work in IE8? What a shock!

Repeat: try putting the floated element first.

[Can't test it myself -- all my Windows virtual machines are at the office.]
 
Steve Dyke
Ranch Hand
Posts: 1616
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bear Bibeault wrote:Something doesn't work in IE8? What a shock!

Repeat: try putting the floated element first.

[Can't test it myself -- all my Windows virtual machines are at the office.]


It works like a charm. Thanks Bear.

Could not do any of this without the help here at JavaRanch. Just remember there are a lot of us who are still learning and have farther to go than we will ever have time for.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic