Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Currently, I have my WebKit.WebView in a ScrolledWindow, because otherwise my window would resize to fir the content. In stead, I would like the content to adjust to the container. So text should wrap, in stead of running straight through and resizing the window. A horizontal scroll bar meant to be there, but not a horizontal one.

share|improve this question
up vote 0 down vote accepted

You would have to apply a custom stylesheet to all pages, which set the max-width of everything in the page to 100%. If you control all the content being displayed in there, set html,body { max-width: 100%; } in your CSS. If you don't control all the content displayed in your web view, then you will have to allow the horizontal scroll bar to be shown when needed, otherwise you will break pages that need it.

share|improve this answer
Really? That sucks :/ Any idea how I can apply a custom style sheet? Do I have to add the style tags and stuff myself, or is there a specific function for this in the WebView widget? – RobinJ Jun 29 '12 at 21:51
WebKit has API to inject CSS or JavaScript into the DOM, but I don't recall what the exact API is at the moment, or if it is available through the GI (gobject-introspection) bindings. – dobey Jun 29 '12 at 21:56
Webkit is currently available in the GI – Hernantz Jun 29 '12 at 22:13
@Hernantz yes it is, but all the API is not fully exposed in the GI bindings. – dobey Jun 30 '12 at 14:49

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.