The default width of the answer boxes is set as follows:
Type of box | Width of box | Example |
Number (separate box) | 40px |
5
|
Unit (separate box) | 40px |
mm
|
Number and unit (combined boxes) | 80px |
5 mm
|
Numeric | 100px |
2 + 3
|
Numeric and unit (combined boxes) | 200px |
2 + 3 mm
|
Numerical formula | 200px |
sqrt(2)
|
Numerical formula and unit (combined boxes) | 300px |
sqrt(2) mm
|
Algebraic formula | 200px |
(a + b)(a - b)
|
Algebraic formula and unit (combined boxes) | 300px |
(a + b)(a - b) mm^2
|
You can change the width of answer boxes by editing the styles.css file located in the .../question/type/formulas directory.
For example, the following part of the styles.css file changes the width of the number box to 80px, that of the unit box to 70px, and that of the combined number and unit box to 140px:
Note: When you edit the styles.css file, you must purge the caches for the changes to take effect. Go to Site Administration -> Development -> Development / Purge all caches.
Note: Several examples in this site have been made with modified answer box widths.
You can change the width of the input boxes by inserting the following JavaScript in the HTML code of the question text.To adjust the width of the boxes, change "70px"* to the desired value.
Note that this script changes the width of all input boxes appearing on the same page.
* 70px ≅ 18.5 mm on a monitor with a standard resolution of 96 dpi
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.0/jquery.min.js"></script> <script> $(document).ready(function() { /* Adjust the width of the input box */ $("input.formulas_number").css("width", "70px"); }); </script>
In some cases, it is best to right-align the contents of the answer boxes. For example, numbers in the vertical columns of accounting statements are usually right-aligned.
The CSS text-align property (center, left, right, justify) can not be applied to the contents of an answer box, which is left-aligned by default. However, if it is set to rtl (from right to left), the CSS direction property will have the effect of right-aligning the contents.
Right-align numbers in the answer boxes of an Accounts Receivable Ledger.
The Formulas question should look like this:
© 2019-2024 Dynamic Courseware (Dominique Bauer)
Documentation: CC0 1.0 Universal - No copyright
Remixes for Moodle: CC BY-NC-SA 4.0 Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International
Contact request sent
Personal space
Save draft messages, links, notes etc. to access later.
No starred conversations
No group conversations
No private conversations
No results
Search people and messages
You can restrict who can message you
You have blocked this user.
You are unable to message this user