What would be needed is a width attribute like availabe in Android layouts, which is named width: wrap-content. Maybe this would be a good proposal for CSS, as it has proven handy in designing screens.