2 Replies - 632 Views - Last Post: 04 September 2013 - 03:39 AM

#1 ak4744710  Icon User is offline

  • D.I.C Head

Reputation: 2
  • View blog
  • Posts: 133
  • Joined: 30-January 13

need help with class and id with a img and border

Posted 01 September 2013 - 01:28 PM

I am trying to take 3 images and use ids to make each have different borders. I want to make 3 total ids one for each img tag. I have posted my code as is can someone please tell me what I am doing wrong.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>    </title>
<link rel="stylesheet" type="text/css" href="myStyle.css" />
<style>
body
{
background-color:#669999;
}
h1
{
color:#ffcc66;
}
#id1
{
border-width:5px;
border-color:#ffcc00;
}
#id2
{
border-width:5px;
border-color:#FAGH00;
}
#id3
{
border-width:5px;
border-color:0099HH;
}
</style>
</head>
<body>
<h1>This is a h1 tag</h1>
<p class="para1">This is paragraph 1 </p>
<p>This is paragraph 2</p>
<img id="id1" src="mario.jpg" width="500" height="450" alt="mario"  >
<img id="id2" src="sonic.jpg" width="500" height="450" alt="sonic">
<img id="id3" src="zelda.jpg" width="500" height="450" alt="zelda">
</body>
</html>


Is This A Good Question/Topic? 0
  • +

Replies To: need help with class and id with a img and border

#2 Anelephant  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 5
  • Joined: 13-June 13

Re: need help with class and id with a img and border

Posted 01 September 2013 - 03:56 PM

A few things about this:

First, please post the errors you are getting, this makes fixing the code a whole lot easier as we actually know what to fix.
Second, in line 29 you missed a #
Third, Put the img id in <p></p> and add a </img> tag in the body, this gets rid of the main error I've been getting
Fourth, you need to put a style type when you include a style tag like <style type="text/css">

And lastly, what are you trying to do with <p class="para1">This is paragraph 1 </p>?
the general form of a paragraph is generally just <p></p>

And anyway, sorry if the colors aren't working (they should be) because I can't see the images on my computer.
And if anyone else notes I typed something wrong, or referenced something incorrectly, or forgot something,sorry, this is my first one of these...
Was This Post Helpful? 0
  • +
  • -

#3 Pogaca  Icon User is offline

  • New D.I.C Head

Reputation: 2
  • View blog
  • Posts: 44
  • Joined: 24-August 13

Re: need help with class and id with a img and border

Posted 04 September 2013 - 03:39 AM

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<style type="text/css">
body
{
background-color:#669999;
}
h1
{
color:#ffcc66;
}
#id1
{
border:5px solid #ffcc00;
}
#id2
{
border:5px solid;
border-color:rgb(0,0,255);
}
#id3
{
border:5px solid;
border-color: rgb(0,0,153);
}
</style>
</head>
<body>
<h1>This is a h1 tag</h1>
<p class="para1">This is paragraph 1 </p>
<p>This is paragraph 2</p>
<img id="id1" src="mario.jpg" width="500" height="450" alt="mario" >
<img id="id2" src="sonic.jpg" width="500" height="450" alt="sonic">
<img id="id3" src="zelda.jpg" width="500" height="450" alt="zelda">
</body>
</html>

I had to use for last two colors RGB values because hex values somehow bug. Same result anyway.
Was This Post Helpful? 1
  • +
  • -

Page 1 of 1