From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nick Dokos Subject: Re: Applying style to a paragraph for HTML export Date: Thu, 05 May 2011 10:05:20 -0400 Message-ID: <29314.1304604320@alphaville.dokosmarshall.org> References: Reply-To: nicholas.dokos@hp.com Return-path: Received: from eggs.gnu.org ([140.186.70.92]:56173) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QHzBp-0000ES-Pd for emacs-orgmode@gnu.org; Thu, 05 May 2011 10:06:02 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QHzBo-0004yc-Ks for emacs-orgmode@gnu.org; Thu, 05 May 2011 10:06:01 -0400 Received: from vms173001pub.verizon.net ([206.46.173.1]:36368) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QHzBo-0004yH-G8 for emacs-orgmode@gnu.org; Thu, 05 May 2011 10:06:00 -0400 Received: from alphaville.dokosmarshall.org ([unknown] [173.76.32.106]) by vms173001.mailsrvcs.net (Sun Java(tm) System Messaging Server 7u2-7.02 32bit (built Apr 16 2009)) with ESMTPA id <0LKQ001PH74WNM20@vms173001.mailsrvcs.net> for emacs-orgmode@gnu.org; Thu, 05 May 2011 09:05:42 -0500 (CDT) In-reply-to: Message from Robert Pluim of "Thu, 05 May 2011 11:37:52 +0200." List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org Cc: nicholas.dokos@hp.com Robert Pluim wrote: > (I thought this would be a FAQ, but I can't find anything similar) > > Hi, > > I'm exporting from org to html, which is working well. Since my final > target is MSWord, I'd like to add style information to various > paragraphs, ie bold, underline etc. I can see how to do eg *bold* for > individual words, but how do I apply that kind of formatting to a span > of text? > > (I'm CSS-ignorant, so please use small words and talk slowly) > Reading section 12.5.8, "CSS support", and experimenting a bit, I came up with a short example that I hope will clarify that section for the CSS-ignorant (which I mostly am): --8<---------------cut here---------------start------------->8--- #+OPTIONS: ^:nil #+STYLE: #+STYLE: * Headline :PROPERTIES: :HTML_CONTAINER_CLASS: bold :END: This is a bold section. This is done by using the HTML_CONTAINER_CLASS property of the subtree and giving it the value bold, then setting the style for class _bold_ to accomplish the desired goal. But you can selectively #+HTML: change some things like this #+HTML: if you want. --8<---------------cut here---------------end--------------->8--- Here is what I know about CSS (but take it with the appropriate grain of salt - as I said, I'm mostly CSS-ignorant): The thing to remember is that you can add ... to delimit HTML inline elements and
...
for HTML block elements. Each can be given a class: ... or an id: .... Classes are hierarchical, ids are targeted. In the style definitions, you write .foo { style info; ...} for classes and #bar {style info; ...} for ids. So you can use #+HTML: ... to add spans or divs at the appropriate places, giving them a class or id as you see fit, and then add #+STYLE: definitions at the top to style them. Be careful when typing: the slightest error will cause the browser to just ignore whole swaths of styling, which makes debugging ... interesting. I tend to edit the html file one tiny thing at a time and redisplaying. When I've figured out what's wrong, I go back to the org file and try the result. Nick