I have some CSS which inserts a dash, unicode U+2014 —, to give a nice formatting on my site ahead of the stated source. Annoyingly it is breaking a new line after this (I've tried changing from span to div but no use).
The document tree looks like:
<span class="source">...</span>
<p>Source author, text goes here etc. etc.</p>
The computed style for the span
line includes display:inline
, whereas the computed style for p
has display:block
, which I'm guessing may be causing the new line?
I'm reading through the relevant CSS and can't see any reason why it should start a new line, I don't have \A in the content as in this question ...
Can any CSS whiz point me to what I'm missing? Alternative implementation of the ::before
pseudo-element required perhaps?
The CSS involved here is
div.source:before{content:"\2014";margin-left:0.9em;margin-right:0.9em; white-space:nowrap;}#content
(I inserted white-space:nowrap a while ago trying to fix this but it didn't do anything to the new line)
` is by default a block-level element, meaning that it will take up 100% width of its parent, therefore forcing itself on a new line. Perhaps @Harry's suggestion would work.
– Terry Oct 20 '13 at 15:31tags (i.e. more paragraphs after the source is stated) so I'm just trying to figure out if I need nth-of-type / first-child to make just the first one display:inline, this feels like over-complicating though ...
– Louis Maddox Oct 20 '13 at 15:39` tag directly following the `` and IE has better support for this selector.
– Harry Oct 20 '13 at 15:48