Code tagged with html

Div to fill remaining space on page (IE, quirks-mode only)

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
  <head>
    <title>Ehr</title>
      <style type="text/css" media="screen" id="test">
		    
        html, body {height: 100%;}
			
        #masthead {
          height: 90px;
          position: absolute;
          width: 100%;
        }
			
        #navbar {
          height: 30px;
          padding: 4px;
          position: absolute;
          left: 0px;
          bottom: 0px;
          width: 100%;
        }
			
        #content {
          height: 100%;
          padding-top: 93px;
        }
			
      </style>
    </head>
    <body style="margin:0px;padding:0px;">
	    
      <div id="masthead">
        MASTHEAD (fixed size, absolute positioned to top)
        <div id="navbar">NAV (nested inside masthead)</div>
      </div>

      <div id="content">
        CONTENT (standard document positioned, with padding-top of masthead height)
      </div>
		
    </body>
</html>
Language Html/Xhtml / Tagged with css, html, fill, fixed, percentage

highlight multiple terms, escape html

Posted by Chad Humphries over 2 years ago
# This will search and replace multiple terms with an arbitrary string 
# but ignore any characters inside angle brackets inside the string 
# eg "This is spantastic!" => This is spantastic! 

def search_highlight text, phrases 
  return text if phrases.blank? 
  phrases.each do |phrase| 
    phrase = Regexp.escape(phrase) 
    unless text.nil? 
      text = text.gsub /((?:\G|>)[^<>]*?)(#{phrase})/i, '\1\2' 
    end 
  end 
  return text 
end
Language Ruby / Tagged with html, parsing