Jump to content

SSteven

Members
  • Content Count

    17
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by SSteven

  1. I have written an HTML page containing Google Fonts. When this HTML page is accessed on a Windows PC, the various Google Fonts used display differences correctly. However, when I access the web page on Android, all the used Google Fonts appear the same. I there a problem with HTML pages containing Google Fonts accessed on Android? If so, how do I fix it? Please note that I'm not asking about Android apps. Only about HTML pages accessed on Android. In fact, even as far as standard fonts are concerned (non-Google fonts), an HTML page displayed on Android , renders only basic San-serif, basic Serif and basic monospace. No other font is recognized. Therefore, what should the approach be for font-selection for HTML pages, in general? Thanks.
  2. I've just discovered I had made a syntax error when linking to the google fonts. On correcting it, the google fonts work perfectly on both PC as well as Android. https://jsfiddle.net/SSteven/83dkauht/2/
  3. SSteven

    em rem and vw

    About the em and rem length units, w3schools states the following: em and rem are relative units, relative to the font size of the element or the root element respectively. Example from w3schools: p { font-size: 16px; line-height: 2em; } In the above CSS code, for <p> elements, the line-height will be twice the font-size, 2 x 16px = 32px. A pixel is an absolute length unit (1 pixel = 1/96th of an inch). Therefore, in the above example, line-height will also be fixed. Therefore, where does the scalability come in? Secondly, regarding the vw unit: It is relative to the viewport's width. As the viewport width decreases, a property expressed as x number of vw units will also shrink. Thus, vw is scalable. However, on smaller viewports, such a dimension is too small to read. Therefore, how useful is vw in practice? Do you know of a (small) example that can demonstrate the utility of vw? Thanks.
  4. SSteven

    Image sprite best practices

    The Image sprite examples in the w3schools tutorial were about icons. 1) Is it recommended to use Image sprites for general images (and not just icons)? For example, if a web-site displays an image gallery of scenery-images, should we use a sprite in this situation? 2) For such general images, which are large in dimension, should we first shrink the images, before combining them into a sprite? If so, to what size (width and height) is it advisable to shrink general images? Thanks.
  5. SSteven

    Image sprite best practices

    What about Company logos? Is it advisable for image sprites to be used for Company logos?
  6. SSteven

    Closing a modal box

    I refer to the following example of a modal on w3schools: https://www.w3schools.com/cssref/tryit.asp?filename=trycss3_target_modal It doesn't contain any JS; only CSS is present. The CSS for the close modal button is: .closebtn:hover, .closebtn:focus { color: #000; text-decoration: none; cursor: pointer; } I'm not clear how this CSS is sufficient to close the modal. Yet it works, without JS. How? Thanks.
  7. SSteven

    Closing a modal box

    This is a cool trick.
  8. SSteven

    background-position: negative value

    Please refer the w3schools example on Image sprites: https://www.w3schools.com/css/tryit.asp?filename=trycss_sprites_nav. Here, the extracted images have negative values for the horizontal position: The #prev id has is set to -47px and the #next id to -91px. What do the negative values signify? The tutorial only states that the top-left corner is (0, 0) and the x-coordinate and y-coordinate increase to the right and bottom respectively, which is standard. Thanks. #prev { left: 63px; width: 43px; background: url('img_navsprites.gif') -47px 0; } #next { left: 129px; width: 43px; background: url('img_navsprites.gif') -91px 0; }
  9. SSteven

    Closing a modal box

    So when I click on the close button, the .modal:target selector is not activated, and so the modal is automatically closed?
  10. As far as I am aware, my Android tablet and the browser are all using defaults. Not aware of any speed booster app.
  11. The page displays its fonts correctly on a PC, but Google fonts (or even standard web fonts for that matter) aren't displayed correctly on Android. This indicates the syntax used to specify the fonts is correct; else it wouldn't have worked on PC. The requested fonts don't appear when the HTML page is invoked on Android.
  12. The following HTML creates an SVG rectangle containing a horizontal linear gradient and text, intended as a Banner. https://jsfiddle.net/SSteven/z7umqfpw/ Note that the text is not centered. How do I center the text? I tried the following, using some information on the web: https://stackoverflow.com/questions/41822510/center-an-svg-inside-a-div However, my attempt doesn't work: https://jsfiddle.net/SSteven/5jg7xhwu/
  13. SSteven

    How to center text in an SVG graphic?

    Thanks for this info. It works perfectly for the horizontal centering. However, vertically, it doesn't appear to be centered. Is there any way to center SVG text vertically? There doesn't appear to be an attribute of <text> for this. Is there a way to do it using JS? (eg: to return the height of the text (th) and the height of the banner (bh) and then do (bh - th)/2, for instance?)
  14. I request an evaluation of the following web page, especially on the use of semantic elements: https://jsfiddle.net/SSteven/qt9d2sfw/ Specifically: 1) At the top, 2 images are supposed to be displayed. (Currently, their alt text is displayed.) I have treated this as the <header>. I have used "float: left" to display both images horizontally. Is the code for the header element and its sub-elements OK? 2) The top menu has been displayed in an <nav> element, which has been styled along with its sub-elements. 3) The "side menu" has been included in an <aside> element. 4) The <main> element contains an <article> element, which has the main content. Both the "side menu" and the <main> element are floated horizontally. 5) Finally, there is a <footer> element. Basically, I'd like to ask: 1) Is the use of the semantic elements correct? 2) Is their styling done correctly or is there a better way? I'd also like to ask about indentation guidelines for HTML code. I have indented the HTML code. What is the normal practice? Thanks.
  15. SSteven

    Feedback on web page's semantic elements

    Thanks for the review. Your points are all well-taken.
  16. SSteven

    Code indentation in HTML

    In programming languages (such as Javascript, C++, etc.), indentation of code is a best practice. In markup languages such as HTML, is code indentation a best practice?
  17. SSteven

    Code indentation in HTML

    >> most better editors do this automatically, with ability to collapse areas of html Notepad++ (with a popularity rating of 20% by users of this website) doesn't seem to auto-indent. Which editor has an auto-indent feature? w3schools suggests an indentation level of 2 spaces, and I'm looking for an editor with 2-space auto-indentation. Thanks.
×