The long-term goal of our research is to develop “intelligent styling” systems that automate the styling processes for Web documents. This thesis developed a framework for a contextual background image retrieval system that can be applied to automatically select background images, which are appropriate to decorate a textual passage in a coherent manner, from the contextual information implied in the sentences. We applied textual summarization techniques to determine possible salient concepts of a given textual passage. Natural language techniques such as name entity extraction, semantic role labeling, together with knowledgebase such as ConceptNet, are integrated for such a purpose. The initial results indicate the potential of the proposed techniques for different categories of textual passages. However, the results also showed that existing commonsense knowledge are rather restricted for the addressed application. This motivated the work of the second part of this thesis which aims to develop web-based text mining techniques to retrieve event-based commonsense knowledge out of web pages. We proposed a framework based on lexico-syntactic pattern matching and semantic role labeling techniques. The evaluation results showed that the proposed approach could automatically accumulate commonsense knowledge efficiently with very high accuracy rates that are close to 98%.