我在网站上有两个不同的页面/节点,我想在CSS中为背景图像设置不同的@page规则。我特别不熟悉打印规则(尽管我每天使用CSS工作),因此我不确定如何完成此操作
我试图将@page与2018-03-28 10:37:51,530 URL used: https://my.domain.org/is/api/getData/D_01
2018-03-28 10:37:51,531 Starting new HTTPS connection (1): my.domain.org
2018-03-28 10:37:51,540 caught excpetion str: []
Traceback (most recent call last):
File "/var/www/engines/controller/get_data.py", line 25, in getTemplate
resp = requests.get(urlstr)
File "/usr/local/lib/python2.7/site-packages/requests/api.py", line 72, in get
return request('get', url, params=params, **kwargs)
File "/usr/local/lib/python2.7/site-packages/requests/api.py", line 58, in request
return session.request(method=method, url=url, **kwargs)
File "/usr/local/lib/python2.7/site-packages/requests/sessions.py", line 508, in request
resp = self.send(prep, **send_kwargs)
File "/usr/local/lib/python2.7/site-packages/requests/sessions.py", line 618, in send
r = adapter.send(request, **kwargs)
File "/usr/local/lib/python2.7/site-packages/requests/adapters.py", line 440, in send
timeout=timeout
File "/usr/local/lib/python2.7/site-packages/urllib3/connectionpool.py", line 601, in urlopen
chunked=chunked)
File "/usr/local/lib/python2.7/site-packages/urllib3/connectionpool.py", line 346, in _make_request
self._validate_conn(conn)
File "/usr/local/lib/python2.7/site-packages/urllib3/connectionpool.py", line 850, in _validate_conn
conn.connect()
File "/usr/local/lib/python2.7/site-packages/urllib3/connection.py", line 314, in connect
cert_reqs=resolve_cert_reqs(self.cert_reqs),
File "/usr/local/lib/python2.7/site-packages/urllib3/util/ssl_.py", line 254, in create_urllib3_context
context = SSLContext(ssl_version or ssl.PROTOCOL_SSLv23)
File "/usr/local/lib/python2.7/site-packages/urllib3/contrib/pyopenssl.py", line 379, in __init__
self._ctx = OpenSSL.SSL.Context(self.protocol)
File "/usr/local/lib/python2.7/site-packages/OpenSSL/SSL.py", line 724, in __init__
_openssl_assert(res == 1)
File "/usr/local/lib/python2.7/site-packages/OpenSSL/_util.py", line 67, in openssl_assert
exception_from_error_queue(error)
File "/usr/local/lib/python2.7/site-packages/OpenSSL/_util.py", line 54, in exception_from_error_queue
raise exception_type(errors)
Error: []
这样的内容放在一起,但这并没有做任何事情。这甚至是可能的,还是@page不可能与类或id配对 - 在这种情况下,我该如何解决这个问题?
编辑,尝试过以下但是没有工作:
body.node-type @page{}
我知道我可能会将背景图片放在一个单独的div中,但这需要对代码进行重大修改,而且我甚至不确定在溢出时它是否会很好用到第二页(因为第一页在两个节点类型中都是唯一的。)
答案 0 :(得分:0)
您无法单独在@page
at-rule内执行此操作。 CSS不支持条件@page
at-rules,条件依赖于匹配标记内的选择器。
正如您所发现的那样,通过将@page
at-rule包含在您希望规则应用的页面中嵌入的<style>
中,可以解决这个问题(假设您有这样的课程)重新匹配在body
元素上,这通常表示文档特定的样式。