Skip to content

Instantly share code, notes, and snippets.

@Terryhung
Last active October 31, 2017 01:54
Show Gist options
  • Save Terryhung/84a642af30ad7a822c52a5ccc25a8b27 to your computer and use it in GitHub Desktop.
Save Terryhung/84a642af30ad7a822c52a5ccc25a8b27 to your computer and use it in GitHub Desktop.
// Java
//without image url
public static void AddDocHead(Elements doc) throws Exception {
Element head = doc.first();
head.prepend("<style>.article-header{content: '';background: linear-gradient(to top, #000 1rem,#fff 40rem,#fff 100%);height: 5rem;display: block;}.main-image{width: 100%;max-height: 700px;opacty: 0.9}.article-content{background-color: #fff;position: absolute;width: 90%;z-index: 1;margin-left: 4%; margin-right: 5%;margin-top: -2rem;font-size: 25px; padding-left: 5px; padding-right: 5px}.article-header:after {content: '';background: #000;background: -moz-linear-gradient(top, #000 28%, #fff 58%, #fff 100%);background: -webkit-linear-gradient(top, #000 22rem,#fff 40rem,#fff 100%);background: linear-gradient(to bottom, #000 22rem,#fff 40rem,#fff 100%);height: 40rem;display: block;} .article-content img{width: 100%} div{white-space: pre-wrap; white-space: -moz-pre-wrap; word-wrap: break-word;}</style>");
}
// with image url
public static void AddDocHead(Elements doc) throws Exception {
Element head = doc.first();
head.prepend("<style>.article-header{content: '';background: linear-gradient(to top, #000 1rem,#fff 40rem,#fff 100%);height: 35rem;display: block;}.main-image{width: 100%;max-height: 700px;opacty: 0.9}.article-content{background-color: #fff;position: absolute;width: 90%;z-index: 1;margin-left: 4%; margin-right: 5%;margin-top: -2rem;font-size: 25px; padding-left: 5px; padding-right: 5px}.article-header:after {content: '';background: #000;background: -moz-linear-gradient(top, #000 28%, #fff 58%, #fff 100%);background: -webkit-linear-gradient(top, #000 22rem,#fff 40rem,#fff 100%);background: linear-gradient(to bottom, #000 22rem,#fff 40rem,#fff 100%);height: 40rem;display: block;} .article-content img{width: 100%} div{white-space: pre-wrap; white-space: -moz-pre-wrap; word-wrap: break-word;}</style>");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment