xhtml

What are the main differences between XHTML and HTML? [closed]

假如想象 提交于 2019-12-29 12:12:19
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 4 years ago . What are the main differences between XHTML and HTML? Which one is better in your opinion, and why? Do most browsers support both? 回答1: This is probably the best article I've read on the differences and relative merits of each: HTML Versus XHTML Which should we use, HTML or XHTML,

Center Div inside another (100% width) div

妖精的绣舞 提交于 2019-12-29 10:29:05
问题 Quite a "simple" problem here and not sure why it's being so complicated. Have a 100% (width) sized div. Have another div positioned in the middle of this div (sized 940px width) Any ideas? :) 回答1: .parent { text-align: center; } .parent > .child { margin: 0 auto; width: 900px; } 回答2: The below style to the inner div will center it. margin: 0 auto; 回答3: for detail info, let's say the code below will make a div aligned center: margin-left: auto; margin-right: auto; or simply use: margin: 0

How to stop html textarea from interpreting html entities into their characters

蓝咒 提交于 2019-12-29 09:37:09
问题 I have an html textarea that is used to display a string from a database. The textarea can be edited and any changes are saved to the database. The problem is that when it recieves entities ® in a string it converts them into their characters, and then when the text is saved the characters overwrite the entities. For example: The database would return the string Microsoft® which would be displayed as Microsoft®, and then saved that way. Is there a way to force textareas to not interpret

Do CSS namespace attribute selectors work with XHTML/HTML elements?

北战南征 提交于 2019-12-29 09:08:19
问题 I want to style elements with xlink:href attribute in a XHTML, however I can't make it work. My test code: <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xyz="http://xyz.org"> <head> <meta charset="UTF-8" /> <title>css namespace</title> <style> body { font-size: 20px; } /* Oops! A normal rule must not precede @namespace rules! */ @namespace html "http://www.w3.org/1999/xhtml"; @namespace xlink "http://www.w3.org/1999/xlink";

noscript alternative in XHTML?

北慕城南 提交于 2019-12-29 08:40:11
问题 In HTML I could do: <noscript><link href="css/stylenojs.css" rel="stylesheet" type="text/css" /></noscript> Is there some compliant way to do so in XHTML Transitional or Strict documents? 回答1: The example you give is invalid in HTML as well as XHTML. No current recommendation provides a way to include a stylesheet unless scripting is enabled. In general, you should avoid <noscript> . Start with something that works, and then build on it. In this case, you could write your stylesheet for non

How do I add type=“text/javascript” to a script tag when using System.Web.Optimization

让人想犯罪 __ 提交于 2019-12-29 06:51:29
问题 I have the following bundles.Add(new ScriptBundle("~/bundles/scripts/common").Include( "~/Scripts/jquery.validationEngine.js", "~/Scripts/common.js")); Which generates <script src="/bundles/scripts/common?v=9O0Yi3fV_GWpGyJQ_QYURiOYy6SEmxUQtkUVN4GXo2U1"></script> When rendered with <asp:PlaceHolder ID="PlaceHolderJs" runat="server"> <%: Scripts.Render("~/bundles/scripts/common") %> </asp:PlaceHolder> Which is not valid HTML as its missing type="text/javascript". How do I make the

Valid way to add noscript in head for wrapping redirect

↘锁芯ラ 提交于 2019-12-29 03:04:12
问题 So I was thinking a simple way to deal with javascript being disabled by the browser would be the following: <head> <title>JavaScript Test</title> <noscript> <meta http-equiv="Refresh" content="1;url=nojs.html" /> </noscript> </head> And having the nojs.html have something like: <p>Return to <a href="jstest.html">test</a> after enabling javascrpt.</p> At the crash page. This isn't my preferred method, but it's nice and simple until something more graceful can be worked out for users without

What are best practices to order elements in <head>?

十年热恋 提交于 2019-12-29 02:21:07
问题 can use anything in any order? does placing of <meta http-equiv="Content-Type" content="text/html;charset=UTF-8"> is important before <title> this is most used, is it best way? <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html lang="en"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8"> <title>Title Goes Here</title> <link rel="stylesheet" href="http://sstatic.net/so/all.css?v=5912"> <link rel="shortcut icon"

ClassNotFoundException in Java Applet using <object> tag

你离开我真会死。 提交于 2019-12-28 19:19:29
问题 I'm trying to embed a Java Applet using the <OBJECT> tag, which is the XHTML Strict way of doing it. After browsing lots of sites, I tried this example which seems to work pretty well: <!--[if !IE]> Firefox and others will use outer object --> <object classid="java:Sample2.class" type="application/x-java-applet" archive="Sample2.jar" height="300" width="450" > <!-- Konqueror browser needs the following param --> <param name="archive" value="Sample2.jar" /> <!--<![endif]--> <!-- MSIE

How do I validate XHTML with nokogiri?

 ̄綄美尐妖づ 提交于 2019-12-28 15:02:57
问题 I've found a few posts alluding to the fact that you can validate XHTML against its DTD using the nokogiri gem. Whilst I've managed to use it to parse XHTML successfully (looking for 'a' tags etc.), I'm struggling to validate documents. For me, this: doc = Nokogiri::XML(Net::HTTP.get(URI.parse("http://www.w3.org"))) puts doc.validate results in a whole heap of: [ #<Nokogiri::XML::SyntaxError: No declaration for element html>, #<Nokogiri::XML::SyntaxError: No declaration for attribute xmlns of