Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[css] Incorrect "Property is ignored" warning when specifying width on inline replaced elements #56907

Closed
PikeUK opened this issue Aug 21, 2018 · 11 comments · Fixed by gizlang/gizcode-extension-samples#95 · 4 remaining pull requests
Closed

[css] Incorrect "Property is ignored" warning when specifying width on inline replaced elements #56907

PikeUK opened this issue Aug 21, 2018 · 11 comments · Fixed by gizlang/gizcode-extension-samples#95 · 4 remaining pull requests
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug css-less-scss Issues and items concerning CSS,Less,SCSS styling verified Verification succeeded

Comments

@PikeUK
Copy link

PikeUK commented Aug 21, 2018

Issue Type: Bug

When specifying a CSS width on an inline replaced element (e.g. an <input>) the following warning is shown:

Property is ignored due to the display. With 'display: inline', the width, height, margin-top, margin-bottom, and float properties have no effect.

The width isn't ignored for replaced inline elements (such as <input>) as you can see in the following testcase: https://jsfiddle.net/Lczhqytu/

From CSS2 spec regarding width (section 10.2):

This property does not apply to non-replaced inline elements.

The same issue applies to the other properties mentioned in the warning.

VS Code version: Code 1.26.1 (493869e, 2018-08-16T18:38:57.434Z)
OS version: Windows_NT x64 10.0.17134

System Info
Item Value
CPUs Intel(R) Core(TM) i7-5820K CPU @ 3.30GHz (12 x 3300)
GPU Status 2d_canvas: enabled
checker_imaging: disabled_off
flash_3d: enabled
flash_stage3d: enabled
flash_stage3d_baseline: enabled
gpu_compositing: enabled
multiple_raster_threads: enabled_on
native_gpu_memory_buffers: disabled_software
rasterization: enabled
video_decode: enabled
video_encode: enabled
webgl: enabled
webgl2: enabled
Memory (System) 15.92GB (7.74GB free)
Process Argv C:\Users\<username>\AppData\Local\Programs\Microsoft VS Code\Code.exe
Screen Reader no
VM 0%
Extensions (4)
Extension Author (truncated) Version
vscode-eslint dba 1.4.14
hg mrc 1.2.3
vscode-apache mrm 1.1.1
vscode-hexdump sle 1.6.0
@octref octref added css-less-scss Issues and items concerning CSS,Less,SCSS styling bug Issue identified by VS Code Team member as probable bug and removed new release labels Aug 21, 2018
@octref octref added this to the Backlog milestone Aug 21, 2018
@octref
Copy link
Contributor

octref commented Aug 21, 2018

While we haven't fixed it, you can set "css.lint.propertyIgnoredDueToDisplay": "ignore" to disable this linting rule.

@bbugh
Copy link

bbugh commented Sep 4, 2018

That didn't work for me, I set both "css.lint.propertyIgnoredDueToDisplay": "ignore" and "scss.lint.propertyIgnoredDueToDisplay": "ignore" and still get the warning.

@MorrisJohns
Copy link

tags can be display: inline and have a width set (e.g. high density image set to logical pixels). Perhaps just change the warning text? Something like:
"Property may ignored on some inline elements. Due to the 'display: inline', the width, height, margin-top, margin-bottom, and float properties only affect replaceable inline elements (IMG, INPUT, TEXTAREA, CANVAS, VIDEO etc)."

@MorrisJohns
Copy link

PS: propertyIgnoredDueToDisplay worked fine.

For others: I went to File | Preferences in VS Code, searched for propertyIgnoredDueToDisplay and changed it to "ignore" and it applied the change immediately - nice work - thanks guys!

@zamarise
Copy link

zamarise commented May 28, 2019

@octref As mentioned in another comment, "css.lint.propertyIgnoredDueToDisplay": "ignore didn't work for me either. I set the following in User and Workspace settings and the warning remained.

 "css.lint.propertyIgnoredDueToDisplay": "ignore",
 "less.lint.propertyIgnoredDueToDisplay": "ignore",
 "scss.lint.propertyIgnoredDueToDisplay": "ignore"

@octref
Copy link
Contributor

octref commented Oct 21, 2019

@aeschli Since there's no way to correctly detect this rule, can we deprecate and drop it?

@aeschli
Copy link
Contributor

aeschli commented Oct 22, 2019

I would suggest fixing the text as suggested in #56907 (comment)

@octref
Copy link
Contributor

octref commented Oct 22, 2019

@aeschli What about float? It applies to all elements. For the 5 properties "width, height, margin-top, margin-bottom, and float", do we have to describe all combinations where it doesn't apply to specific elements (such as the combination of width on "inline replaced element"), so this diagnostic is wrong?

@aderchox
Copy link

I'm having the same issue.

@aeschli aeschli changed the title Incorrect "Property is ignored" warning when specifying CSS width on inline replaced elements [css] Incorrect "Property is ignored" warning when specifying width on inline replaced elements Feb 21, 2020
@octref octref assigned aeschli and unassigned octref May 1, 2020
@hroger1030
Copy link

Bump, issue is still present. How long does it take to remove a rule that just isn't correct?

If this is something that a developer feels that needs to be identified and messaged, lets fix the existing problem (bad messaging) before we worry about how to identify and message for this correctly. No functionality is better than broken functionality.

@aeschli
Copy link
Contributor

aeschli commented Sep 10, 2020

I removed the check.

@roblourens roblourens added the verified Verification succeeded label Oct 1, 2020
@github-actions github-actions bot locked and limited conversation to collaborators Oct 25, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.