A data hiding method based on integer factorization via e-books in the EPUB format with XHTML and CSS files for copyright protection is proposed. Firstly, a fixed number m of leading bits in a message are transformed into an integer which is then factorized to yield k results. One of the k factorizations is chosen according to the decimal value of a number n of the subsequent message bits with n being decided as the binary logarithm of k. Next, the chosen factorization, denoted as a × b, is utilized to create a combined use of the and elements in the XHTML files to embed the m + n message bits by including into the two elements a class selector named according to the value of a as well as a text segment with b characters. The class selector is created by the use of a CSS pseudo-element. The resulting web pages are of no visual difference from the original, achieving a steganographic effect. The security of the embedded message is also considered by randomizing the message bits before they are embedded. Good experimental results and comparisons with exiting methods show the feasibility of the proposed method for copyright protection of e-books.