Closed Bug 1555338 Opened 6 years ago Closed 6 years ago

User agent stylesheet redefines style from user's CSS

Categories

(Core :: CSS Parsing and Computation, defect)

66 Branch
defect
Not set
normal

Tracking

()

RESOLVED INVALID
Tracking Status
firefox67 --- affected
firefox68 --- affected
firefox69 --- affected

People

(Reporter: kes-kes, Unassigned)

Details

Attachments

(3 files)

User Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:66.0) Gecko/20100101 Firefox/66.0

Steps to reproduce:

create HTML (see attached file)
Apply fontsize to the entire page, but my style from CSS is redefined by user agent style sheet.

This happens only when CSS is inlined into HTML.
When I same CSS include via

<link href="/static/css/invoice.css" rel="stylesheet">

then computations done as expected.

Actual results:

see attached screenshots.
you can see that computed font-size is 16

Expected results:

computed font-size MUST BE 12

Attached file font_issue.html
Attached image _.jpg
Attached image _2.jpg

chrome says:

table {
    white-space: normal;
    line-height: normal;
    font-weight: normal;
    font-size: medium;     <<<<<<<<<<<<<<<<
    font-style: normal;
    color: -internal-quirk-inherit;
    text-align: start;
    font-variant: normal;
}

I do not think that browser defaults should take precendence over user defined css.
in any case when style sheet is not inlined I got expected results.

Thus you should fix only the case when CSS is inlined.

Hi, I managed to reproduce this issue in All versions of Firefox on Ubuntu 18.04. Mac OsX and Windows 10.

Status: UNCONFIRMED → NEW
Component: Untriaged → CSS Parsing and Computation
Ever confirmed: true
Product: Firefox → Core

This is working as expected (and as you noted, it works the same in other browsers). Tables reset the font-size so that it's not inherited.

Changing it is probably not possible since this rule has been

You should probably just use standards mode (<!doctype html> at the beginning of the page), or table { font-size: inherit; line-height: inherit; ... }.

Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → INVALID

Changing it is probably not possible since this rule has been

... there since forever in quirks mode. :)

@Emilio Cobos Álvarez

This is working as expected

You say that this is expected that same CSS works differently depending on when style is inlined VS included??

I expect that regardless of how CSS defined:

  1. via <style>
  2. via <link href="/static/css/invoice.css" rel="stylesheet">

It MUST have same behavior!

It behaves the same if you use <style> as if you use <link rel="stylesheet"> here. Can you attach or link to a repro that behaves differently? The behavior difference should only happen in quirks mode vs. not.

I have attached. https://bugzilla.mozilla.org/attachment.cgi?id=9068378&action=edit
copy all CSS from: <style>/*<![CDATA[*/ into separate file invoice.css and add link href="invoice.css" rel="stylesheet"> instead

probably something is missing. I will investigate into this.

Great, please reopen when you figure out, thanks!

You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: