Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 9 of 9
  1. #1
    Regular Coder
    Join Date
    Oct 2002
    Posts
    137
    Thanks
    0
    Thanked 0 Times in 0 Posts

    how are sites letting users choose font-size?

    I have seen this on http://www.anandtech.com. They have buttons that let users choose a larger or smaller font-size. How is this done?

  • #2
    Regular Coder
    Join Date
    Apr 2005
    Location
    1.12°W 52.67°N
    Posts
    218
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Somekind of Javascript coding...how i'm not sure though.

    EDIT: This may help, scroll down to the second posting...clicky clicky

  • #3
    Senior Coder
    Join Date
    Dec 2004
    Location
    Essex, UK
    Posts
    2,636
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Yes, http://www.anandtech.com/ is using javascript to change the stylesheet. The different stylesheets contain the different font sizes.

    You do not need to do it this way though - multiple stylesheets could be a bit annoying.

    An easier method would be to make the font size of a certain element bigger -

    <a href="#" onclick="document.getElementById("content").style.fontSize='12pt'">

  • #4
    Regular Coder
    Join Date
    Apr 2005
    Location
    1.12°W 52.67°N
    Posts
    218
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Heh, easier than i thought it would be.

  • #5
    Master Coder
    Join Date
    Apr 2003
    Location
    in my house
    Posts
    5,211
    Thanks
    39
    Thanked 201 Times in 197 Posts
    you can do it with css so that they can select whatever size of text they would like.. try it with this site (CodingForums), and change your browser text size or, hold te control button as your roll your mousewheel.

    Bazz
    Last edited by bazz; 09-21-2005 at 11:58 AM.
    "The day you stop learning is the day you become obsolete"! - my late Dad.

    Why do some people say "I don't know for sure"? If they don't know for sure then, they don't know!
    Useful MySQL resource
    Useful MySQL link

  • #6
    Master Coder felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, Australia
    Posts
    6,642
    Thanks
    0
    Thanked 649 Times in 639 Posts
    Of course anyone can override the font sizes on any web page simply by creating their own stylesheet on their computer and telling the browser to use that instead of the one supplied by the site.
    Stephen
    Learn Modern JavaScript - http://javascriptexample.net/
    Helping others to solve their computer problem at http://www.felgall.com/

    Don't forget to start your JavaScript code with "use strict"; which makes it easier to find errors in your code.

  • #7
    Master Coder
    Join Date
    Apr 2003
    Location
    in my house
    Posts
    5,211
    Thanks
    39
    Thanked 201 Times in 197 Posts
    Quote Originally Posted by felgall
    Of course anyone can override the font sizes on any web page simply by creating their own stylesheet on their computer and telling the browser to use that instead of the one supplied by the site.
    I didn't know that. I wonder, though, why should they have to do that if the site is coded as well as it could be.

    bazz
    "The day you stop learning is the day you become obsolete"! - my late Dad.

    Why do some people say "I don't know for sure"? If they don't know for sure then, they don't know!
    Useful MySQL resource
    Useful MySQL link

  • #8
    Master Coder felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, Australia
    Posts
    6,642
    Thanks
    0
    Thanked 649 Times in 639 Posts
    Example:

    Someone who is partially blind may only be able to read text on their screen that displays in 72 point or greater. They can define their own stylesheet to force all web pages to display their content at that size.

    Another example:

    Someone wo prefers to see consistency in web pages may define their own stylesheet so that ALL web pages are displayed using the user selected layout.
    Stephen
    Learn Modern JavaScript - http://javascriptexample.net/
    Helping others to solve their computer problem at http://www.felgall.com/

    Don't forget to start your JavaScript code with "use strict"; which makes it easier to find errors in your code.

  • #9
    Master Coder
    Join Date
    Apr 2003
    Location
    in my house
    Posts
    5,211
    Thanks
    39
    Thanked 201 Times in 197 Posts
    yeh, I can see that some people may have a need for such things. However, (in my ideal world ), I also think that that would not be needed if sites were properly coded. Couldn;t the user, then, not set their browser text size and this would then apply to all sites?

    I am interested in the other scenario you mentioned. Specifically how to layout websites consistently, with my own stylesheet, where different sites use different id and class names.

    were I to understand such a thing, I could use it.

    bazz
    "The day you stop learning is the day you become obsolete"! - my late Dad.

    Why do some people say "I don't know for sure"? If they don't know for sure then, they don't know!
    Useful MySQL resource
    Useful MySQL link


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •