emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Nick Dokos <nicholas.dokos@hp.com>
To: emacs-orgmode@gnu.org
Cc: nicholas.dokos@hp.com
Subject: Re: Applying style to a paragraph for HTML export
Date: Thu, 05 May 2011 10:05:20 -0400	[thread overview]
Message-ID: <29314.1304604320@alphaville.dokosmarshall.org> (raw)
In-Reply-To: Message from Robert Pluim <rpluim@gmail.com> of "Thu, 05 May 2011 11:37:52 +0200." <pkniptp7aj3.fsf@this.is.really.invalid>

Robert Pluim <rpluim@gmail.com> 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 type=text/css> .bold {color: red;} </style>
#+STYLE: <style type=text/css> .inner {color: blue;} </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: <span class="inner">
change some things like this
#+HTML: </span>
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 <span>...</span> to delimit
HTML inline elements and <div>...</div> for HTML block elements.

Each can be given a class: <span class="foo">...</span> or an id:
<span id="bar">...</span>. 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

  parent reply	other threads:[~2011-05-05 14:06 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-12-17  8:52 should the mail list be splitted resp. sub-tagged ? Torsten Wagner
2010-12-17 12:15 ` Andrew J. Korty
2010-12-17 14:00   ` Giovanni Ridolfi
2010-12-17 15:56   ` Nick Dokos
2010-12-17 17:28     ` Samuel Wales
2010-12-17 15:40 ` Nick Dokos
2010-12-17 18:21 ` William Gardella
2010-12-17 20:33 ` William Gardella
2010-12-17 21:16   ` Eric S Fraga
2010-12-18 12:09 ` Torsten Wagner
2011-01-04 15:19   ` Bastien
2011-01-04 17:39     ` Štěpán Němec
2011-01-04 18:12       ` Bastien
2011-01-04 18:31         ` Jeff Horn
2011-01-04 19:49         ` Štěpán Němec
2011-01-04 20:43           ` Nick Dokos
2011-01-04 18:52       ` Nick Dokos
2011-01-04 19:25         ` Robert Pluim
2011-01-05  9:13           ` Achim Gratz
2011-01-05  9:56             ` Robert Pluim
     [not found]           ` <rpluim@gmail.com>
2011-01-04 20:02             ` Nick Dokos
2011-01-05  8:15               ` Robert Pluim
2011-05-05 14:05             ` Nick Dokos [this message]
2011-05-05 14:35               ` Applying style to a paragraph for HTML export Jambunathan K
  -- strict thread matches above, loose matches on Subject: below --
2011-05-05  9:37 Robert Pluim
2011-05-05 12:05 ` Jambunathan K
2011-05-05 12:33   ` Robert Pluim
2011-05-05 12:45     ` Jambunathan K
2011-05-05 13:16       ` Robert Pluim
2011-05-05 12:51     ` Jambunathan K

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=29314.1304604320@alphaville.dokosmarshall.org \
    --to=nicholas.dokos@hp.com \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).