5 Replies - 607 Views - Last Post: 12 December 2012 - 09:42 AM

#1 BelfastMan  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 25-October 12

Beginning HTML

Posted 11 December 2012 - 01:42 PM

Hi there. I was wondering if someone could tell me why the image in the following code appears in the browser as a little white box with a red x in the centre? Appreciate the help guys.

<!DOCTYPE html>
<html>
<body>

<h1>My First Heading</h1>

<p>My first paragraph</p>

<p>This is my first link:<a href="http://www.learndevnow.com">Learndevnow</a></p>

<img src="../html5 Logo">

</body>
</html>



Is This A Good Question/Topic? 0
  • +

Replies To: Beginning HTML

#2 BenignDesign  Icon User is offline

  • holy shitin shishkebobs
  • member icon




Reputation: 6216
  • View blog
  • Posts: 10,731
  • Joined: 28-September 07

Re: Beginning HTML

Posted 11 December 2012 - 01:46 PM

View PostBelfastMan, on 11 December 2012 - 03:42 PM, said:

<img src="../html5 Logo">




You have no file extension on the file name. Provided your file path is correct, adding the extension should fix your problem.

Should be something like
<img src="../myimage.jpg" />

Was This Post Helpful? 3
  • +
  • -

#3 BelfastMan  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 25-October 12

Re: Beginning HTML

Posted 11 December 2012 - 01:58 PM

View PostBenignDesign, on 11 December 2012 - 01:46 PM, said:

View PostBelfastMan, on 11 December 2012 - 03:42 PM, said:

<img src="../html5 Logo">




You have no file extension on the file name. Provided your file path is correct, adding the extension should fix your problem.

Should be something like
<img src="../myimage.jpg" />


Many thanks!
Was This Post Helpful? 0
  • +
  • -

#4 Vompaudi  Icon User is offline

  • New D.I.C Head

Reputation: 2
  • View blog
  • Posts: 43
  • Joined: 23-November 12

Re: Beginning HTML

Posted 11 December 2012 - 02:37 PM

Where is the <head> section?? It is essential part of HTML-code! That piece of code would not pass validating. And I recommend to learn already from beginning to make valid code. That will help you so much in the future. It might feel indifferent to leave some parts from code, but everything even small tag is important!
Was This Post Helpful? 0
  • +
  • -

#5 Atli  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 3730
  • View blog
  • Posts: 6,017
  • Joined: 08-June 10

Re: Beginning HTML

Posted 11 December 2012 - 03:10 PM

Interestingly, the <head> element is not required to pass validation. The <title> element, however, is. According the the HTML specs, the <title> element should be inside a <head> element, but the W3C validator doesn't complain if it's just left in the <html> element.

So in theory, you are correct. There should be a <head> section with a <title> element in all HTML pages. But in practice you could just put a <title> element instead and leave out the <head>. (Not that I'd recommend it.)


By the way, if we are going to be going into validation mistakes. The <img> tag requires an "alt" attribute.
Was This Post Helpful? 2
  • +
  • -

#6 BelfastMan  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 25-October 12

Re: Beginning HTML

Posted 12 December 2012 - 09:42 AM

View PostVompaudi, on 11 December 2012 - 02:37 PM, said:

Where is the <head> section?? It is essential part of HTML-code! That piece of code would not pass validating. And I recommend to learn already from beginning to make valid code. That will help you so much in the future. It might feel indifferent to leave some parts from code, but everything even small tag is important!

Thank you so much for your input.

View PostAtli, on 11 December 2012 - 03:10 PM, said:

Interestingly, the <head> element is not required to pass validation. The <title> element, however, is. According the the HTML specs, the <title> element should be inside a <head> element, but the W3C validator doesn't complain if it's just left in the <html> element.

So in theory, you are correct. There should be a <head> section with a <title> element in all HTML pages. But in practice you could just put a <title> element instead and leave out the <head>. (Not that I'd recommend it.)


By the way, if we are going to be going into validation mistakes. The <img> tag requires an "alt" attribute.

Excellent clarification....many, many thanks!
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1