diff --git a/CHANGES.rst b/CHANGES.rst
index f28248a3c..563efe5de 100644
--- a/CHANGES.rst
+++ b/CHANGES.rst
@@ -70,6 +70,8 @@ Bugs fixed
Patch by James Addison.
* #11886: Print the Jinja2 template path chain in ``TemplateNotFound`` exceptions.
Patch by Colin Marquardt.
+* #11598: Do not use query components in URLs for assets in EPUB rendering.
+ Patch by David Runge.
Testing
-------
diff --git a/sphinx/builders/html/__init__.py b/sphinx/builders/html/__init__.py
index 287bb79ce..e14b7c10e 100644
--- a/sphinx/builders/html/__init__.py
+++ b/sphinx/builders/html/__init__.py
@@ -1051,8 +1051,10 @@ class StandaloneHTMLBuilder(Builder):
for key, value in css.attributes.items()
if value is not None]
uri = pathto(os.fspath(css.filename), resource=True)
- if checksum := _file_checksum(outdir, css.filename):
- uri += f'?v={checksum}'
+ # the EPUB format does not allow the use of query components
+ if self.name != 'epub':
+ if checksum := _file_checksum(outdir, css.filename):
+ uri += f'?v={checksum}'
return f''
ctx['css_tag'] = css_tag
@@ -1079,8 +1081,10 @@ class StandaloneHTMLBuilder(Builder):
# https://docs.mathjax.org/en/v2.7-latest/configuration.html#considerations-for-using-combined-configuration-files
# https://github.com/sphinx-doc/sphinx/issues/11658
pass
- elif checksum := _file_checksum(outdir, js.filename):
- uri += f'?v={checksum}'
+ # the EPUB format does not allow the use of query components
+ elif self.name != 'epub':
+ if checksum := _file_checksum(outdir, js.filename):
+ uri += f'?v={checksum}'
if attrs:
return f''
return f''