width

Display Inline-Block with Widths as Percent

拈花ヽ惹草 提交于 2019-12-18 03:58:37
问题 I'm trying to put 2 sections beside each other using inline-block and widths as a percentage, but it's not filling up the entire width of my window. What I have so far: HTML <section class="left-content"> "Some Code" </section> <section class="main-content"> "Some More Code" </section> CSS .left-content, .right-content { width: 15%; min-width: 150px; padding: 5px; display: inline-block; overflow: hidden; vertical-align: top; } .main-content { width: 85%; min-width: 712px; padding: 10px;

How to calculate the font's width?

孤街浪徒 提交于 2019-12-18 02:49:43
问题 I am using java to draw some text, but it is hard for me to calculate the string's width. for example: zheng中国... How long will this string occupy? 回答1: For a single string, you can obtain the metrics for the given drawing font, and use that to calculate the string size. For example: String message = new String("Hello, StackOverflow!"); Font defaultFont = new Font("Helvetica", Font.PLAIN, 12); FontMetrics fontMetrics = new FontMetrics(defaultFont); //... int width = fontMetrics.stringWidth

How to serve up different javascript files by browser width

半腔热情 提交于 2019-12-18 02:41:39
问题 So I want certain Javascript files for certain browser widths. I know that @media serves up specific CSS per browser width and some devices. How would I do something similar for Javascript files, WITHOUT using server side calls? Is is possible with Javascript to call other Javascript files based on browser width? If so, How? Thanks in advance. 回答1: While I'm unsure on why, you can always import JavaScript files through JS Script. The following links give some information on this. http://www

How to serve up different javascript files by browser width

风流意气都作罢 提交于 2019-12-18 02:41:10
问题 So I want certain Javascript files for certain browser widths. I know that @media serves up specific CSS per browser width and some devices. How would I do something similar for Javascript files, WITHOUT using server side calls? Is is possible with Javascript to call other Javascript files based on browser width? If so, How? Thanks in advance. 回答1: While I'm unsure on why, you can always import JavaScript files through JS Script. The following links give some information on this. http://www

Prevent text from overlap table td width

为君一笑 提交于 2019-12-17 18:27:26
问题 How can I restrict the table <td> entry to expanding over the entire screen when the entry is too long? 回答1: Well, there's max-width , max-height , and overflow in CSS. So td.whatever { max-width: 150px; max-height: 150px; overflow: hidden; } would restrict the maximum width and height to 150px, and it can be anything from less than 150 up to 150, and anything that doesn't fit inside that will be clipped off and hidden from view. Overflow's default ( overflow: visible; ) is to simply allow

use initial width for element not working in IE

假装没事ソ 提交于 2019-12-17 17:52:57
问题 I have a graph plugin that inserts canvas and a legend <table> to its container. In this plugin the table has no width defined and in my CSS there is a width for tables inside that container were my plugin gets inserted. So, the new div is inheriting table{ width: 100%} from the CSS and rendering wrong. I tried to use width: initial; , looks good on Chrome but IE doesn't like it check browser compatibility I admit changing/forcing a inline CSS in the script/plugin since it has to work in any

Adjusting div width and height after rotated

时光总嘲笑我的痴心妄想 提交于 2019-12-17 17:52:49
问题 If I have these rules: width:50px; height:100px; -moz-transform: rotate(0deg) and then an event changes the transform to: -moz-transform: rotate(90deg) logically, shouldn't that automatically exchange the width and the height? I need the rotate to switch width and height for accurate position detection. Thanks, Joe 回答1: It seems like the transform is applied after everything else, so the width and height aren't updated. The best solution I can think of is to calculate the rotated dimensions

How do I get the max value of scrollLeft?

倖福魔咒の 提交于 2019-12-17 17:47:34
问题 Okay I'm using jQuery and currently getting max value of scrollbar doing this: var $body = $('body'); $body.scrollLeft(99999); // will give me the max value since I've overshot var max_value = $body.scrollLeft(); // returns 300 $('body').scrollLeft(0); When I try this: $body[0].scrollWidth I just get the actual width of the contents - 1580 I'm thinking there has to be a better way I'm forgetting. EDIT To clarify, I also tried $(window).width() and $(document).width() which gave me 1280 and

How to make children auto fit parent's width only with CSS?

时间秒杀一切 提交于 2019-12-17 10:59:20
问题 I have a server-side component that generates a fluid layout "toolbar" using DIV without fixed width, generating many A inside it. Then I need customize that layout to make all A tags auto fit to the parent width. But the number of children is variable and the parent's width isn't known (it auto fits itself to the window). I made some tests with this Fiddle: http://jsfiddle.net/ErickPetru/6nSEj/1/ But I can't find a way to make it dynamic (uncomment the last A tag to see how it ins't working,

Setting a maximum width on a ViewGroup

十年热恋 提交于 2019-12-17 08:29:07
问题 How do I set the maximum width of a ViewGroup? I am using a Theme.Dialog activity, however, this does not look so good when resized to bigger screens, it's also sort of lightweight and I don't want it taking up the whole screen. I tried this suggestion to no avail. Also, there is no android:maxWidth property like some views. Is there a way to restrict the root LinearLayout so that it is only (for example) 640 dip? I am willing to change to another ViewGroup for this. Any suggestions? 回答1: One