HTML - Displaying Code
This is probably basic, but it's driving me mad.
I want to show a bit of code that the reader can copy. How can i do this? Similar TutorialsHow do you display code as text on the page, rather than running it? Like you do here in between [*code][*/code] tags. Thanks. Can't figure out why the page is displaying only HTML code. My assumption is: I indicated a wrong path to the image hosted with 000webhost.com. Otherwise I have no clue why the code doesn't display online. Here is the code. Can anybody spot the problem? Thanks in advance! =========================================== HTML Code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv = "content-type" content = "text/html; charset = utf-8"/> <title>Russkaya Zvezda</title> </head> <body> <table width='100%'> <tr> <td align ='center'> <img src = "http://www.russkayazvezda.com/GRAY_VK_RZ_MY_RABOTAEM_raster.jpg" width = "100%" alt = "RUSSKAYA ZVEZDA"/> </td> </tr> <tr> <td> <p style = "text-align: center;"> Copyright © 2000 - 2012 by Russkaya Zvezda Inc. </p> </td> </tr> </table> </body> </html> Hello, I am a student and working on a simple first project. All I'm doing right now is writing my code in text edit, saving it as "test.html", and dragging and dropping the file onto Safari/Firefox to view my code. Everything works when I'm at my college's computer lab, but when I'm on my own mac notebook, the files load in the browser as my code. I've tried a variety of samples and checked my preferences, but I can't figure out what I'm doing wrong. Sample code I'm using - <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> <HTML> <HEAD> <TITLE>Simple Link Example 2</TITLE> </HEAD> <BODY> <H1 ALIGN="CENTER">Creating Relative Reference Links</H> <HR> <P>Open <A HREF="practice1.html">Practice 1</A>.</P> <P> Open <A HREF="practice2.html">Practice 2</A>.</P> <P>Open <A HREF="practice3.html" TARGET="_blank"> Practice 3</A> in a new window.</P> </BODY> </HTML> Please help! I'm trying to wrap up an assignment and have been banging my head against the wall all night. Thanks! cordelia Hello, I've created a table with two columns, the second column is fixed width at 64px and contains a div, the div has a border and contains some text, the text renders to larger than 64px. This is a cut down version of a more complex page to illustrate the problem so just changing it to divs or some such wont help. In IE6 and FF2 the div border automatically stretches to contain the text, in IE7 the div is set to 64px and stays there, I don't think this is the correct behaviour, but I can't seem to find another mention of this problem, could anyone give me some pointers? tia, Dave here's the code or here http://members.iinet.com.au/~daven@powerup.com.au/ and the shorter url http://tinyurl.com/6gnpuc <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <HTML> <BODY> <table cellspacing="0" cellpadding="0" style="width:100%"> <tr valign="top" style="width:100%;"> <td> hello </td> <td style="width: 64px;"> <DIV style="border: solid 1px #0000FF"> dsadsadsdsadas </DIV> </td> </tr> </table> </BODY> </HTML> I've created a webpage using html and was wondering if there was any way that when I open the file to have the address bar display a "fake" url. That is, when I open the file instead of saying "file:///Users.filename.html" it will say "www.example.com" in the browser's address bar. I'm on Mac OS and my browser is Google Chrome, if that helps. Hi, I am trying to format this page to look like it has two columns, first column = "Action...", second column = "Key...". The html: HTML Code: <HTML> <HEAD> <TITLE>Test title</TITLE> <LINK REL="STYLESHEET" TYPE="TEXT/CSS" HREF="style.css" /> </HEAD> <BODY BGCOLOR="#FFFFFF" TEXT="#000000"> <P><A NAME="keyboard_shortcuts"></A><B>Using the keyboard</B></P> <P>Some text. </P> <P>The following buttons have keyboard shortcut keys:</P> <DIV ID="fields_left"><B><I>Action...</I></B></DIV> <DIV ID="fields_right"><B><I> Key...</I></B></DIV> <HR> <DIV ID="fields_left"><IMG SRC="img1.bmp" ALT="alttext1" BORDER=0 /></DIV> <DIV ID="fields_right">Esc1</DIV> <DIV ID="fields_left"><IMG SRC="img2.bmp" ALT="alttext2" BORDER=0 /></DIV> <DIV ID="fields_right">Esc2</DIV> <P>Related topics</P> <P>some text....</P> </BODY> </HTML> The css: Code: #fields_left { float:left; padding: 10px; text-align:left; width:30%; } #fields_right{ float:left; padding: 10px; text-align:left; width:70%; } I am trying to have an image and text next it as if it was a table with two columns, but it is not coming out as expected: Does anybody know whats going on here ? I'm on XP, IE 7 http://bbmodding.com/index.html I don't see anything obvious in the code that would explain why it's not displaying. Does IE just hate me? Displays PERFECTLY in FF. I just don't understand.. Edit: Thanks for the help guys. I feel stupid. I can always count on this site to help me fix my problems . I need to display 40-50 images one-by-one using forward and backward buttons. It doesn't seem too difficult, but I'm pretty lost. Please help! Hi! I've been working with html for a couple of years, but working with XML, C#, ASP.Net for the past three months and I may be exhausted, but for the life of me I cannot see why the image is not displaying for this page. See code below: <table width="100%" border="0"> <tr> <td align="center"><font face="Times, Arial, Helvetica"><a href="picLHVSMFP.htm" target="main"><img src="../images/picSHVSMFP.jpg" width="324" height="500" alt="Harmony Village - Sheppard - Main Floor Plan" border="0"> </a></font></td> </tr> <tr> <td> </td> </tr> <tr> <td align="center"><font color="#000000">Harmony Village - Sheppard - Main Floor Plan</font></td> </tr> <tr> <td> </td> </tr> <tr> <td align="center"><a href="picHVSFP4.htm"><img src="../images/rightarrow.gif" width="11" height="10" border="0"></a> <font color="#003333"><a href="future.htm">Future Projects</a></font> <a href="picHVSFP2.htm"><img src="../images/leftarrow.gif" width="11" height="10" border="0"></a> </td> </tr> </table> I have underlined and bolded the image that is not displaying. The other images on the page are displaying and the links work and I have triple-checked the spelling and opened the image with Adobe Photoshop multiple times. I have even tried decreasing the image size, although larger images have displayed on the website without problems. Is there a syntax problem that I am just not seeing? I have attached the image as well. Thanks!!! So, right now I have a single page that loads flash files. It takes the name of the file and the size of the frame from the address bar, then uses that to load the game. However, the problem I have is displaying a tidbit of info about the game. I managed to make it scroll with a nice script, but unfortunately I have no idea how to store the content that goes in the actual iframe. Currently, the frame loads its info from the file itself, by using javascript to get the name of the game and retrieve the valid information. However, this makes the game loader 53 kilobytes, versus the 1-2 kb is was previously. Clearly, this is not an efficient solution - especially if I add more than the 80 or so games I have. Imagine the mess if it was like 1000 games, ugh. I try to add only the quality games though, so I doubt i'll ever reach that number. Quality over quantity, right? Still, what should I do to store the information and quickly look it up without downloading a bunch of information onto the user's computer? Hello, my name is North, and my website is not displaying correctly in IE. I am putting this here because my website is build with php, but the actual content on the pages are html, so i thought that this would be the place. http://north-see.com/judge/index.php?pid=0 this is the link to the site. I am making it for a persons book. Any ideas? Any common things that happen like this in IE? I found an old thread about this but it seems no one was there. I am also new at this so forgive me if I posted in the wrong place. I am using a javascript to replace my smiley characters with a smiley image in comments. The first comment will show all the images. The remaining comments just show smiley characters. Here is the code Code: var smilies = new Array(); smilies[';)'] = 'smileys/wink.gif'; smilies[':)'] = 'smileys/smile.gif'; smilies[':('] = 'smileys/mad.gif'; function showSmilies(){ foo = document.getElementById('div').innerHTML; for ( x in smilies ) { _search = x.replace( /\(/g, '\\(' ); _search = _search.replace( /\)/g, '\\)' ); _search = _search.replace( /\[/g, '\\[' ); _search = _search.replace( /\]/g, '\\]' ); search = new RegExp( _search, "g" ); foo = foo.replace( search, function(found){ return '<img src="'+smilies[found]+'" />'; }); } document.getElementById('div').innerHTML = foo; } if(window.addEventListener){ window.addEventListener('load',showSmilies,false); } else { if(window.attachEvent){ window.attachEvent('onload',showSmilies); } } I have tried changing document.getElementById('div').innerHTML to document.getElementsByTagName('body')[0] It will replace everything on my page and it will also display smileys with a code and link with them. All I need it to do is display smileys in my "div" with the comments. This is also just an add on to my site. Thanks Hi all, My site displas in FF perfect but not in IE any reason for this? i took out some code which i thought would help but still no joy. heres the code i have now and my site is in my signature. HTML Code: "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <head> <meta content="text/html; charset=iso-8859-1" http-equiv="Content-Type"/> <title>Basicproduction</title> </head> <body style="margin:0;background:#000;"> <div style="text-align:center;"> <a target="_blank" href="http://www.myspace.com/basicproduction"><img width="750" height="650" border="0" alt="" img src="/bpholding copy.jpg"/></a> </div> </body> </html> Thanks Hello, I have a web page that is built using components. The footer of the page is a component. When building the page, the footer is added using a glob. In the footer, there is supposed to be a bunch of Korean characters. Currently, they are not displaying properly. When the glob is viewed alone, it is still incorrect. However, if the source is viewed, the Korean characters are correct in the source, but are displaying incorrectly in the page. The charset is already set to UTF-8. What could be the issue here? http://mindscapemedia.co.uk/bug.html Hi, it's a while since I came across this bug, forgot which fix I used for it last time. If anyone could point me to a suitable page or alternatively tell me how to get round this issue I'd be grateful. Check the page in FF/Safari/Chrome it works how I intend it to, check it in IE it bugs out and the last div goes over onto the next line. I've spent more than an hour messing around with different hacks trying to fix this now Can someone take a look at this page: http://www.robotsandcomputers.com/ro...wcomplaint.htm in IE and tell me why the text isn't showing up? It shows up just fine in Chrome and Firefox. Thanks... Hi I'm new to html and trying to make my first basic html website. I want to display calendar. I know I can hardcode a calendar in CSS or in HTML but I have to do it for every month. Is there a way I can display a calendar without hardcoding ?? Please help !!!!!!! Mav Hi Could anyone take a look at my site at www.cyclistsfc.org.uk in Firefox and IE tell me why the navbar is showing in FF but not IE? Its just simple tables so I suppose I must have forgotten to close something somewhere... Cheers Luke Hi all, I have a select box in an html form which simply doesn't appear in ie6. I dont know what is relevant to this problem, but loosely, the layout is as follows: <div id="content"> <form> <p class="label"><label for="allocation">Label</label></p> <p class="input"><select name="allocation" id="allocation"> <option value="0">option1</option> ... </select> <div class="clear"></div> </form> </div> the label paragraph is floated left and input floated right, clear simply clears the floats. Other things in the form include tinyMCE textareas and textboxes. The submit button has an onclick handler that validates before returning true or false for php to put values into a mysql database. Everything else works fine but the select box is simply not there in ie6. Any help would be greatly appreciated, Thanks, Conrad Hello, I am having issues with the way my iFrame is displaying in internet explorer. It displays properly in Firefox, i just don't understad what I'm doing wrong the site is: www.mortgagesbykd.com |