I would just use div elements in this case, with nice classes describing the domain. You could argue up and down about using all kinds of HTML elements that give a better semantic meaning of intent, but for instance in the case of the dialog element, that is not intended for writing dialogs between characters in a play, it is however intended to present a dialog box to the user for interacting. But the fact that you can change and style that element to your hearts desire in CSS is nifty - but I would not recommend doing so.
The reason for that is simply that unless you are careful, you override that behavior and appearance for every such element. Let's say this is an interactive application for playwrights, you may want to include dialog boxes in addition to the "dialog" in the play.
I propose this solution:
.character{
display: block;
float: left;
}
.line{
margin-bottom: 20pt;
width: 400px;
margin-left: 50pt;
}
With the following HTML:
<div class="character">Jeff</div>
<div class="line">This sure is a nice website we've got now.</div>
<div class="character">Joel</div>
<div class="line"> It certainly is. By the way, working at FogCreek rocks.</div>
<div class="character">Jeff</div>
<div class="line">Of course it does. Have you played Rock Band yet?
<br/>It's a lot of fun.</div>
Running JSFiddle: https://jsfiddle.net/quz9cj2f/6/
Now you can actually implement some standard play formatting, that I nicked from this place: http://ptfaculty.gordonstate.edu/lking/CPF_play_formatting2.pdf
.play {
font-family: courier;
}
.play{
margin-top: 1in;
margin-left: 1.5in;
margin-right: 1in;
margin-bottom: 1in;
}
.character {
display: block;
margin-left: 4in;
text-transform: uppercase;
}
.direction:before{
margin-left: 2.75in;
content: "(";
}
.direction:after{
content: ")";
}
.line {
margin-bottom: .3in;
}
With this HTML:
<div class="play">
<div class="character">Jeff</div>
<div class="direction">JEFF is enthusiastic!</div>
<div class="line">This sure is a nice website we've got now.</div>
<div class="character">Joel</div>
<div class="direction">Jumping continuously</div>
<div class="line"> It certainly is. By the way, working at FogCreek rocks.</div>
<div class="character">Jeff</div>
<div class="line">Of course it does. Have you played Rock Band yet?
<br/>It's a lot of fun.</div>
</div>
Working JSFiddle: https://jsfiddle.net/quz9cj2f/9/
Or you could go all in and use CSS attribute selectors and create a custom attributes for the meta information:
.play {
font-family: courier;
}
.play{
margin-top: 1in;
margin-left: 1.5in;
margin-right: 1in;
margin-bottom: 1in;
}
.character {
display: block;
margin-left: 4in;
text-transform: uppercase;
}
.line[direction]:before{
margin-left: 2.75in;
content: "(" attr(direction) ")";
display: block;
}
.line {
margin-bottom: .3in;
}
Now you have gotten rid of the extra elements, and added the meta info as attributes - now you could quite easy transform this from some kind of nice data structure from JSON or XML or other interchange formats into this:
<div class="play">
<div class="character">Jeff</div>
<div direction="Enthusiastic" class="line">This sure is a nice website we've got now.</div>
<div class="character">Joel</div>
<div direction="Shaking his head" class="line"> It certainly is. By the way, working at FogCreek rocks.</div>
<div class="character">Jeff</div>
<div class="line">Of course it does. Have you played Rock Band yet?
<br/>It's a lot of fun.</div>
</div>
https://jsfiddle.net/quz9cj2f/11/