Re:The least amount of CSS for a decent looking site (2023)
by solstice on Tuesday October 07, 2025 @02:08AM
(#45499862)
This bookmarklet to shrink the width has been in my toolbox for a long time:
javascript:(function(){%20var%20myBody%20=%20document.getElementsByTagName('body')[0];%20var%20myBodyWidth%20=%20myBody.style.width;%20if%20(!myBodyWidth%20||%20myBodyWidth%20===%20'auto'%20||%20myBodyWidth%20===%20'inherit')%20{%20myBody.style.width%20=%20'1200px';%20myBody.style.marginLeft%20=%20'auto';%20myBody.style.marginRight%20=%20'auto';%20myBody.style.position%20=%20'relative';%20myBody.style.cssFloat%20=%20'none';%20}%20else%20{%20myBody.style.width%20=%20'auto';%20myBody.style.position%20=%20'static';%20}%20})();
[ Parent
| on HN ]
Re:The least amount of CSS for a decent looking site (2023)
by dev_l1x_be on Tuesday October 07, 2025 @02:34AM
(#45499988)
This summarizes the web ghetto pretty neatly.
Re:The least amount of CSS for a decent looking site (2023)
by vasvir on Tuesday October 07, 2025 @05:53AM
(#45501206)
Thanks that's an interesting trick.
This is beautified if somebody wants to see how it is done.
function() {
var myBody = document.getElementsByTagName('body')[0];
var myBodyWidth = myBody.style.width;
if (!myBodyWidth || myBodyWidth === 'auto' || myBodyWidth === 'inherit') {
myBody.style.width = '1200px';
myBody.style.marginLeft = 'auto';
myBody.style.marginRight = 'auto';
myBody.style.position = 'relative';
myBody.style.cssFloat = 'none';
} else {
myBody.style.width = 'auto';
myBody.style.position = 'static';
}
}