<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>dotvoid.com &#187; html</title>
	<atom:link href="http://www.dotvoid.com/tag/html/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.dotvoid.com</link>
	<description>Experiments and thoughts in PHP and javascript</description>
	<lastBuildDate>Tue, 11 Oct 2011 12:49:15 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Background color for inline text</title>
		<link>http://www.dotvoid.com/2011/10/background-color-for-inline-text/</link>
		<comments>http://www.dotvoid.com/2011/10/background-color-for-inline-text/#comments</comments>
		<pubDate>Tue, 11 Oct 2011 12:47:35 +0000</pubDate>
		<dc:creator>Danne</dc:creator>
				<category><![CDATA[Web]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[html]]></category>

		<guid isPermaLink="false">http://www.dotvoid.com/?p=477</guid>
		<description><![CDATA[In searching for a solution to a CSS problem I had I stumbled over another interesting problem, similar to mine. Most people seemed to agree that it
was impossible to do in pure CSS. The effect those people were after is commonly used in magazines where text with a background color is put over an image. A simple effect [...]]]></description>
			<content:encoded><![CDATA[<p>In searching for a solution to a CSS problem I had I stumbled over another interesting problem, similar to mine. Most people seemed to agree that it<br />
was impossible to do in pure CSS. The effect those people were after is commonly used in magazines where text with a background color is put over an image. A simple effect hard to achieve.</p>
<p>One solution was to surround each line of text using styled span elements. Another solution used &#8221;<a href="http://samcroft.co.uk/2011/jquery-plugin-for-inline-text-backgrounds/">a teeny weeny jquery&#8221;</a> to solve the problem. I&#8217;m sure it&#8217;s a solid solution but using jquery and javascript to be able to style text is, well, wrong. Forcing editors to add invisible span elements in text is also not a good idea. But - the effect can actually be achieved using css only and still keep the html simple and semantically correct.</p>
<p>If you use a block element, like &lt;p&gt;, and set the background color, it will be  a filled square behind the text. By setting the css display property to inline you get  close to the effect wanted.</p>
<p><img class="alignnone size-full wp-image-482" title="block-1" src="http://www.dotvoid.com/wp-content/uploads/2011/10/block-1.png" alt="" width="327" height="81" /></p>
<p>So far it is simple. The problem then is that using padding on inline text will only affect the horisontal padding (text indentation) on the first and last line of text. You get the following effect.</p>
<p><img class="alignnone size-full wp-image-483" title="block-2" src="http://www.dotvoid.com/wp-content/uploads/2011/10/block-2.png" alt="" width="339" height="82" /></p>
<p>In order to get the effect we want we need to add two elements. A surrounding block element (div) surrounding the paragraph and an inline element (span) surrounding the text inside the paragraph. Both of which is semantically without meaning.</p>
<p>First we add a left border on the surrouding block element. Then we move the text in the span element slightly to the left. The background color is set on the paragraph and does not move. Using this neat little trick we simulate text padding or indentation on each line of text.</p>
<p><img class="alignnone size-full wp-image-484" title="block-3" src="http://www.dotvoid.com/wp-content/uploads/2011/10/block-3.png" alt="" width="335" height="83" /></p>
<p>Finally we need to fix the vertical padding and line height to get rid of the spacing between the text lines. The end result is not perfect. There are still problems when the user resize text and you need to be careful with the spacing in Internet Explorer. But it&#8217;s a good start.</p>
<p><a href="http://www.dotvoid.com/wp-content/uploads/2011/10/block-4.png"><img class="alignnone size-full wp-image-485" title="block-4" src="http://www.dotvoid.com/wp-content/uploads/2011/10/block-4.png" alt="" width="336" height="86" /></a></p>
<p>Chrome sometimes change line height seemingly in a random fashion when inserting html &lt;br&gt;. Setting white-space to pre-line fix this behaviour. If not for Internet Explorer it could be simplifed further. Internet Explorer does not seem to support white-space: pre-line. So Internet Explorer still needs manually added html breaks.</p>
<p>The full source</p>
<pre>&lt;pre&gt;
&lt;html&gt;
  &lt;head&gt;
  &lt;style type="text/css"&gt;
  div#column {
    border-left: 6px solid #000;
  }

<code>  p.subs {
    display: inline;
    font: bold 14px/18px arial;
    color: #fff;
    background: #000;
    padding: 1px 0 1px 0;
    white-space: pre-line; /* Not understood by IE, use manual br for IE */
  }</code>

<code>  p.subs span {
    position: relative;
    left: -3px;
  }

  p.subs br {
    display: none;
  }
  &lt;/style&gt;
</code>

<code>  &lt;!--[if IE ]&gt;
    &lt;style type="text/css"&gt;
      p.subs br {
      display: inline;
    }
    &lt;/style&gt;
  &lt;![endif]--&gt;
  &lt;/head&gt;
  &lt;body&gt;
    &lt;div id="column"&gt;
      &lt;p class="subs"&gt;&lt;span&gt;Ground round &lt;br /&gt;
salami pig, meatball short loin frankfurter &lt;br /&gt;
short ribs pork hamburger rump &lt;br /&gt;
strip steak beef ribs T-bone salami ham hock.&lt;/span&gt;&lt;/p&gt;
    &lt;/div&gt;
  &lt;/body&gt;
&lt;/html&gt;</code></pre>


<div class="shr-bookmarks shr-bookmarks-expand shr-bookmarks-center shr-bookmarks-bg-knowledge">
<ul class="socials">
		<li class="shr-comfeed">
			<a href="http://www.dotvoid.com/2011/10/background-color-for-inline-text/feed" rel="nofollow" class="external" title="Subscribe to the comments for this post?">Subscribe to the comments for this post?</a>
		</li>
		<li class="shr-delicious">
			<a href="http://delicious.com/post?url=http://www.dotvoid.com/2011/10/background-color-for-inline-text/&amp;title=Background+color+for+inline+text" rel="nofollow" class="external" title="Share this on del.icio.us">Share this on del.icio.us</a>
		</li>
		<li class="shr-facebook">
			<a href="http://www.facebook.com/share.php?v=4&amp;src=bm&amp;u=http://www.dotvoid.com/2011/10/background-color-for-inline-text/&amp;t=Background+color+for+inline+text" rel="nofollow" class="external" title="Share this on Facebook">Share this on Facebook</a>
		</li>
		<li class="shr-googlebuzz">
			<a href="http://www.google.com/buzz/post?url=http://www.dotvoid.com/2011/10/background-color-for-inline-text/&amp;imageurl=" rel="nofollow" class="external" title="Post on Google Buzz">Post on Google Buzz</a>
		</li>
		<li class="shr-linkedin">
			<a href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http://www.dotvoid.com/2011/10/background-color-for-inline-text/&amp;title=Background+color+for+inline+text&amp;summary=In%20searching%20for%20a%20solution%20to%20a%20CSS%20problem%20I%20had%20I%20stumbled%20over%20another%C2%A0interesting%20problem%2C%20similar%20to%20mine.%20Most%20people%20seemed%20to%20agree%20that%20it%0D%0Awas%20impossible%20to%20do%20in%20pure%20CSS.%20The%20effect%20those%20people%20were%20after%C2%A0is%20commonly%20used%20in%20magazines%20where%20text%20with%20a%20background%20color%20is%20put%C2%A0over%20a&amp;source=dotvoid.com" rel="nofollow" class="external" title="Share this on LinkedIn">Share this on LinkedIn</a>
		</li>
		<li class="shr-plaxo">
			<a href="http://www.plaxo.com/?share_link=http://www.dotvoid.com/2011/10/background-color-for-inline-text/" rel="nofollow" class="external" title="Share this on Plaxo">Share this on Plaxo</a>
		</li>
		<li class="shr-stumbleupon">
			<a href="http://www.stumbleupon.com/submit?url=http://www.dotvoid.com/2011/10/background-color-for-inline-text/&amp;title=Background+color+for+inline+text" rel="nofollow" class="external" title="Stumble upon something good? Share it on StumbleUpon">Stumble upon something good? Share it on StumbleUpon</a>
		</li>
		<li class="shr-twitter">
			<a href="http://twitter.com/home?status=Background+color+for+inline+text+-+http://bit.ly/nJD9I7&amp;source=shareaholic" rel="nofollow" class="external" title="Tweet This!">Tweet This!</a>
		</li>
</ul>
<div style="clear:both;"></div>
</div>

]]></content:encoded>
			<wfw:commentRss>http://www.dotvoid.com/2011/10/background-color-for-inline-text/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Standards are difficult</title>
		<link>http://www.dotvoid.com/2004/04/standards-are-difficult/</link>
		<comments>http://www.dotvoid.com/2004/04/standards-are-difficult/#comments</comments>
		<pubDate>Tue, 20 Apr 2004 15:17:48 +0000</pubDate>
		<dc:creator>Danne</dc:creator>
				<category><![CDATA[Web]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[web design]]></category>

		<guid isPermaLink="false">http://www.commodi.com/?p=71</guid>
		<description><![CDATA[
I have been trying to get dotvoid.com look the same would you prefer Internet Explorer or, as me, Mozilla. I have disregarded Opera even though the few times I&#8217;ve tested it, it seemed to be a good enough browser. I just assume Opera has no problems as I try my hardest to stick to the [...]]]></description>
			<content:encoded><![CDATA[<div class="preamble">
<p>I have been trying to get dotvoid.com look the same would you prefer Internet Explorer or, as me, <a href="http://www.mozilla.org/">Mozilla</a>. I have disregarded <a href="http://www.opera.com/">Opera</a> even though the few times I&#8217;ve tested it, it seemed to be a good enough browser. I just assume Opera has no problems as I try my hardest to stick to the standards. There are a few things bugging me that I still need to sort out though.</div>
<p>First and foremost I am actually very annoyed at the embeddable HTML editing widget in Mozilla. Supporting the same kind of embeddable wysiwyg editor in Mozilla as existing in IE was a great decision. Annoyingly the mozilla team made the editor insert a <span style="font-style: italic;">&lt;BR&gt;</span> instead of a new paragraph when hitting enter. This makes it very hard for me to create a completely xhtml 1.1 compliant site using my own Firesite CMS. Sigh.</p>
<div id="attachment_73" class="wp-caption aligncenter" style="width: 190px"><img class="size-full wp-image-73" title="Dotvoid.com design" src="http://www.dotvoid.com/wp-content/uploads/2008/09/fs__media_mod_action_007.png" alt="Dotvoid.com design" width="180" height="189" /><p class="wp-caption-text">Dotvoid.com design</p></div>
<p>The menus I have created on the left side of the pages are supposed to look like tabs, which they also do in Mozilla. This effect is easily achieved using CSS and a negative right margin for the menu item which overlays the border of the page content. I don&#8217;t explain so good so just look at the above image and you&#8217;ll see what I mean. In Internet Explorer I get a thin border between the (active) start menu item and the content. I am sure I&#8217;m going about it wrong but I just can&#8217;t seem to figure it out.</p>


<div class="shr-bookmarks shr-bookmarks-expand shr-bookmarks-center shr-bookmarks-bg-knowledge">
<ul class="socials">
		<li class="shr-comfeed">
			<a href="http://www.dotvoid.com/2004/04/standards-are-difficult/feed" rel="nofollow" class="external" title="Subscribe to the comments for this post?">Subscribe to the comments for this post?</a>
		</li>
		<li class="shr-delicious">
			<a href="http://delicious.com/post?url=http://www.dotvoid.com/2004/04/standards-are-difficult/&amp;title=Standards+are+difficult" rel="nofollow" class="external" title="Share this on del.icio.us">Share this on del.icio.us</a>
		</li>
		<li class="shr-facebook">
			<a href="http://www.facebook.com/share.php?v=4&amp;src=bm&amp;u=http://www.dotvoid.com/2004/04/standards-are-difficult/&amp;t=Standards+are+difficult" rel="nofollow" class="external" title="Share this on Facebook">Share this on Facebook</a>
		</li>
		<li class="shr-googlebuzz">
			<a href="http://www.google.com/buzz/post?url=http://www.dotvoid.com/2004/04/standards-are-difficult/&amp;imageurl=" rel="nofollow" class="external" title="Post on Google Buzz">Post on Google Buzz</a>
		</li>
		<li class="shr-linkedin">
			<a href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http://www.dotvoid.com/2004/04/standards-are-difficult/&amp;title=Standards+are+difficult&amp;summary=%0D%0A%0D%0AI%20have%20been%20trying%20to%20get%20dotvoid.com%20look%20the%20same%20would%20you%20prefer%20Internet%20Explorer%20or%2C%20as%20me%2C%20Mozilla.%20I%20have%20disregarded%20Opera%20even%20though%20the%20few%20times%20I%27ve%20tested%20it%2C%20it%20seemed%20to%20be%20a%20good%20enough%20browser.%20I%20just%20assume%20Opera%20has%20no%20problems%20as%20I%20try%20my%20hardest%20to%20stick%20to%20the%20standards.%20&amp;source=dotvoid.com" rel="nofollow" class="external" title="Share this on LinkedIn">Share this on LinkedIn</a>
		</li>
		<li class="shr-plaxo">
			<a href="http://www.plaxo.com/?share_link=http://www.dotvoid.com/2004/04/standards-are-difficult/" rel="nofollow" class="external" title="Share this on Plaxo">Share this on Plaxo</a>
		</li>
		<li class="shr-stumbleupon">
			<a href="http://www.stumbleupon.com/submit?url=http://www.dotvoid.com/2004/04/standards-are-difficult/&amp;title=Standards+are+difficult" rel="nofollow" class="external" title="Stumble upon something good? Share it on StumbleUpon">Stumble upon something good? Share it on StumbleUpon</a>
		</li>
		<li class="shr-twitter">
			<a href="http://twitter.com/home?status=Standards+are+difficult+-+File: /data/app/webapp/functions.php<br />Line: 66<br />Message: Duplicate entry 'wyfcZ' for key 'code'&amp;source=shareaholic" rel="nofollow" class="external" title="Tweet This!">Tweet This!</a>
		</li>
</ul>
<div style="clear:both;"></div>
</div>

]]></content:encoded>
			<wfw:commentRss>http://www.dotvoid.com/2004/04/standards-are-difficult/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

