Solved

Need to make a div tag same width as preceding table

Posted on 2011-09-28
5
269 Views
Last Modified: 2012-06-21
I have buttons in a button div tag I'd like to make the same width as the table above it. The buttons can not be part of that table since that's creating weird AJAX jqGrid delays and we solved that by moving it outside the table.

Now I just need to adjust the width.

I can use the padding: and set the right border, but do not want an explicit number of pixels. I want the right edge to line up with the right edge of the table above it.

I would like to use the float style, but want to make it resolution independent.

Can I request the width of the table? Then use that in the div tag?

Thanks.
0
Comment
Question by:newbieweb
  • 3
5 Comments
 
LVL 96

Expert Comment

by:Bob Learned
Comment Utility
I would love to see some HTML/CSS, if you have it...
0
 

Author Comment

by:newbieweb
Comment Utility
I've requested that this question be deleted for the following reason:

We decided to put the button back into the table, which solved the problem. Sorry. I am killing the question. Thanks though...
0
 
LVL 18

Accepted Solution

by:
Rartemass earned 500 total points
Comment Utility
I know you have requested the question to be deleted, but the general answer for this is to use percentages or ems when dealing with width.
Basically you will need to set the width of the table in ems (eg 10em) then set the width of the button to the same size.
If you already have pixels specified for sizes, you can use a converter to get the em value.
http://riddle.pl/emcalc/

Just for information, ems are a relative size to the width of the letter m in the system font. This means it scales based on the configuration of the system. Viewers can use any screen resolution at the page will still look in scale.
0
 

Author Comment

by:newbieweb
Comment Utility
I will grant points for that answer event though I am not actively pursuing an answer.
0
 

Author Closing Comment

by:newbieweb
Comment Utility
Thanks.

And thanks LearnedOne. Sorry to abandon that few that catch your eye lately. Maybe next time...

Cheers.
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Suggested Solutions

When writing CSS, there are a few simple rules that will make your life easier.    1. Using ‘* {box-sizing:border-box;}’. Using this will wrap all your elements in a nice little compact box-model that will give you the width you want, like so... …
This article discusses four methods for overlaying images in a container on a web page
In this tutorial viewers will learn how to style transparent/translucent elements using alpha transparency in CSS Start with a normal styled element, such as a div.: Define its "background-color" property as "rgba (255, 255, 255, .5): The numbers in…
In this tutorial viewers will learn how to style elements, such a divs, with a "drop shadow" effect using the CSS box-shadow property Start with a normal styled element, such as a div.: In the element's style, type the box shadow property: "box-shad…

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now