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

Hints are influenced by page stylesheet if it uses * #925

Closed
The-Compiler opened this issue Sep 5, 2015 · 1 comment
Closed

Hints are influenced by page stylesheet if it uses * #925

The-Compiler opened this issue Sep 5, 2015 · 1 comment

Comments

@The-Compiler
Copy link
Member

@The-Compiler The-Compiler commented Sep 5, 2015

e.g. with this test case using * { padding: 10px; }:

<head>
    <style type="text/css">
        * {
            padding: 10px;
        }
    </style>
</head>

<body>
    <p>
    This hint should look normal:
    <a href="http://www.qutebrowser.org/">test</a>
    </p>
</body>

We get this:
qutebug1

One possibility would be to set padding to 0 with !important for the hints:

diff --git a/qutebrowser/browser/hints.py b/qutebrowser/browser/hints.py
index fdc2014..c7ccf18 100644
--- a/qutebrowser/browser/hints.py
+++ b/qutebrowser/browser/hints.py
@@ -342,6 +342,8 @@ class HintManager(QObject):
             ('font', config.get('fonts', 'hints') + ' !important'),
             ('border', config.get('hints', 'border') + ' !important'),
             ('opacity', str(config.get('hints', 'opacity')) + ' !important'),
+            ('padding', '0 !important'),
+            ('margin', '0 !important'),
         ]

         # Make text uppercase if set in config

(we might also want to set more - see CSS reset)

but that renders the hint at the wrong position:

qutebug2

@9man
Copy link

@9man 9man commented Nov 10, 2015

Here is an example I found in the wild of this. On this university journal website, the hints all have a width that extends to the right edge of the page. They have three style sheets linked for that main page (1, 2, 3). The second one has a rule of:

body > * {
    padding: 0 2.5%;
    width: 95%;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants