Defendants: how is the custom font scale literally detected so that it can be used as a variable?
I am trying to create some if / else statements based on scaling the user's font (without scaling the browser) in order to expand the usability of my sites.
The two answers given are workarounds for one case (the described scenario). The originally proposed scenario was not my best choice. However, this can be used, and this is the easiest to understand scenario that I could come up with on the fly.
"If the font size is changed, the value of the offsetWidth / Height properties of elements whose size depends on their text content or CSS size with dimensions related to the font size (em, ex, etc.) will change."
I am trying to figure out a way to create my layout / css by the font size set by the user in his browser settings. For example, in Chrome, if the user set their primary font size to 24 -
Chrome: Wrench> Options> Under the Hood> Change Font and Language Settings> Fonts and Encoding> Font> Change> Font Size = "24".
-
How can I pick up an event? Working with an example ... let's say I have a DIV with a set height of 60px:
<div class="dwarfer" style="height: 60px;">Whoa?</div>
- 9 pt. 24 ( ), ctrl + "mousewheeling down" . :
$divheight = 5px/1em
, , . , , PHP, $divheight .
, :
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" » "http://www.w3.org/TR/html4/strict.dtd">
<html dir="ltr">
<head>
<meta http-equiv="Content-Type" content="text/html; » charset=utf-8">
<title>Font Resizer Demo</title>
<script type="text/javascript" src=" » textresizedetector.js"></script>
</head>
<body>
<h1>Resize me, now!</h1>
</body>
</html>
<script type="text/javascript" » src="textresizedetector.js"></script>
<script type="text/javascript">
// <![CDATA[
/* id of element to check for and insert test SPAN into */
TextResizeDetector.TARGET_ELEMENT_ID = 'header';
/* function to call once TextResizeDetector was initialized */
TextResizeDetector.USER_INIT_FUNC = init;
// ]]>
</script>
http://www.alistapart.com/articles/fontresizing/.
, $divheight CSS :
<?php
$divheight = 5px/1em
echo '.dwarfer{' . "\n" . 'height:' . $divheight; . "\n" . '}'
?>
! !