-2

I'm trying to think responsive, in terms of web design. First silly test I do: open a blank file, put it some text inside. Big amount of text (lorem ipsum, whatever). Even without any HTML markup. Save the file with .html extension, and open it with any modern browser: Chrome, Firefox, IE, Safari...

If you change the size of the window (the viewport size) the text automatically wraps to fit in the screen. No DOCTYPE declaration, no meta tags. Nothing. Just plain text.

Why do the browser automatically wrap text to fit in the screen? Do they have any default responsive behaviour? Under what criteria?

Jorge Arévalo
  • 2,858
  • 5
  • 36
  • 44
  • What do you expect them to do, not wrap the text and make users have to read everything on one line, let alone use that horizontal scrollbar? – BoltClock Oct 23 '16 at 14:27
  • Exactly. I expect the browser to do nothing until I tell it to do it using meta tags, doctype declaration, CSS rules... whatever. Is that a wrong way to think? I mean, I thank the browser for being helpful, but I'd like to know the criteria: why wrapping text instead of showing an horizontal scrollbar? All the browsers do the same? Where do the rules come from? HTML standard?, browser convention? – Jorge Arévalo Oct 23 '16 at 14:31
  • There weren't any standards 25 years ago (except maybe the IETF HTML draft), so I presume browser makers decided to make web pages actually usable, and one way of doing that was by making them look just like pages of a digital document, or even a book. Whether this would be considered "responsive" is debatable, considering what we know as Responsive Web Design is a relatively new thing (this decade), and prior to that the word "responsive" had a different meaning altogether. Note that CSS didn't even exist until the late 90s. – BoltClock Oct 23 '16 at 14:52
  • Mmm, ok. That sounds like reasonable. They just decided to make pages look nice before the "responsive web design" concept. – Jorge Arévalo Oct 24 '16 at 21:10
  • 1
    Before CSS, in fact. – BoltClock Oct 25 '16 at 04:02

1 Answers1

1

Browsers have default styling for just about everything. Like @BoltClock mentioned, it's more of a legacy from the old wild west days of the www and an attempt to be nice and help the display.

When it comes to word wrapping, the default behavior of just about every browser is to break & wrap on whitespace and punctuation. This is not considered "responsive" in the modern sense of the term, but just readable and expected behavior from computer applications.

If you look at the DOM Inspector in Dev Tools in Chrome you will see a number of applied styles to elements that come from user.agent.stylesheet (similarly named things exist in the other browsers, too). These are the default styles that the browser automatically applies that are usually overridden by your own custom style rules. If you want a list of those default styles in sure you can scrounge them up from the browser manufacturer's websites.

Dave Cripps
  • 929
  • 7
  • 11