  The bandwidth theorem [Mathematische Annalen, 343(1):175--205, 2009] states
that any $n$-vertex graph $G$ with minimum degree
$\big(\tfrac{k-1}{k}+o(1)\big)n$ contains all $n$-vertex $k$-colourable graphs
$H$ with bounded maximum degree and bandwidth $o(n)$. We provide sparse
analogues of this statement in random graphs as well as pseudorandom graphs.
  More precisely, we show that for $p\gg \big(\tfrac{\log
n}{n}\big)^{1/\Delta}$ asymptotically almost surely each spanning subgraph $G$
of $G(n,p)$ with minimum degree $\big(\tfrac{k-1}{k}+o(1)\big)pn$ contains all
$n$-vertex $k$-colourable graphs $H$ with maximum degree $\Delta$, bandwidth
$o(n)$, and at least $C p^{-2}$ vertices not contained in any triangle. A
similar result is shown for sufficiently bijumbled graphs, which, to the best
of our knowledge, is the first resilience result in pseudorandom graphs for a
rich class of spanning subgraphs. Finally, we provide improved results for $H$
with small degeneracy, which in particular imply a resilience result in
$G(n,p)$ with respect to the containment of spanning bounded degree trees for
$p\gg \big(\tfrac{\log n}{n}\big)^{1/3}$.
