How to scale SVG image to fill browser window?

How about: html, body { margin:0; padding:0; overflow:hidden } svg { position:fixed; top:0; bottom:0; left:0; right:0 } Or: html, body { margin:0; padding:0; overflow:hidden } svg { position:fixed; top:0; left:0; height:100%; width:100% } I have an example on my site using (roughly) this technique, albeit with 5% padding all around, and using position:absolute instead of … Read more

Space Before Closing Slash?

The answer is people wish to adhere to Appendix C of the XHTML1.0 specification. Which you only need to do if you are serving XHTML as text/html. Which most people do, because XHTML’s real MIME type (application/html+xml) does not work in Internet Explorer. No current browser cares for the space. Browsers are very tolerant of … Read more

How to access HTML element without ID?

function findFirstDescendant(parent, tagname) { parent = document.getElementById(parent); var descendants = parent.getElementsByTagName(tagname); if ( descendants.length ) return descendants[0]; return null; } var header = findFirstDescendant(“header-inner”, “h1”); Finds the element with the given ID, queries for descendants with a given tag name, returns the first one. You could also loop on descendants to filter by other criteria; … Read more

jQuery Selector + SVG Incompatible?

This happens because SVG DOM spec differs a lot from HTML DOM. SVG DOM is a different dialect, and some properties have same names but mean different things. For example, to get the className of an svg element, you use: svg.className.baseVal The properites affected by this are className is SVGAnimatedString height,width, x, y, offsetWidth, offsetHeight … Read more

Is it possible to dynamically scale text size based on browser width?

Hell yeah! Set your <body> font size when the window is resized with a little javascript. (I’ve used jQuery for convenience here: $( document ).ready( function() { var $body = $(‘body’); //Cache this for performance var setBodyScale = function() { var scaleSource = $body.width(), scaleFactor = 0.35, maxScale = 600, minScale = 30; //Tweak these … Read more

Tick symbol in HTML/XHTML

I think you’re using less-well-supported Unicode values, which don’t always have glyphs for all the code points. Try the following characters: ☐ (0x2610 in Unicode hexadecimal [HTML decimal: &#9744;]): an empty (unchecked) checkbox ☑ (0x2611 [HTML decimal: &#9745;]): the checked version of the previous checkbox ✓ (0x2713 [HTML decimal: &#10003;]) ✔ (0x2714 [HTML decimal: &#10004;]) … Read more

Is writing self closing tags for elements not traditionally empty bad practice?

I’m assuming your question has to do with the red trailing slash on self-closing elements when you view source in Firefox. If so, you’ve stumbled into one of the most vehement, yet simultaneously passive aggressive debates in the browser maker vs. web developer wars. XHTML is NOT just about a document’s markup. It’s also about … Read more

JavaServer Faces 2.2 and HTML5 support, why is XHTML still being used

It seems that you misunderstood the purpose of XHTML like as many people during the XHTML overhype a couple of years ago. Long story short: check our XHTML wiki page. Carefully read it. In a nutshell, Facelets absolutely doesn’t care about the doctype being used in the generated HTML output. You can perfectly fine declare … Read more