The Web Design Group

... Making the Web accessible to all.

Welcome Guest ( Log In | Register )

> html & CSS newbie. My container code is not working., help with container code
msa969
post Oct 7 2018, 02:17 PM
Post #1





Group: Members
Posts: 3
Joined: 7-October 18
Member No.: 26,727



Hi i am new html and css style sheets.

My container code is not working.

Please help me. Thank you
CODE
<!DOCTYPE html>
<html>
<head>
<title>Mr Alam New Zealand</title>
<style>
  h1   {color: #ffffcc; font-size: 24pt; text-align:center}
</style>
<style>
  body {background-color: green;}
  
</style>

<style>
a:link    {color: blue;}
a:visited {color: green;}
a:hover   {color: red;}
a:active  {color: orange;}
</style>
#container /*Styles for Container*/
{
width:800px;
margin: 0 auto;
padding: 5px;
background-color: dodgerblue;
text-align: center;
font-family: Arial, Verdana, sans-serif;
font-size: 14pt
}

</head>

<body>

<div id="container">
  <h1>
SEE AMAZING SCENERY
  </h1>
  <p style="text-align:center">
<img src=newzealand.jpg width=700px>
<br>
Explore the lakes, rivers and mountains of New Zealand, or
<a href="http://www.australia.com/">
  click here to explore Australia
</a>
  </p>
  
</div>

<font color="white">
help
</font>
</body>
</html>


Attached thumbnail(s)
Attached Image
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
 
Reply to this topicStart new topic
Replies
Christian J
post Oct 7 2018, 04:44 PM
Post #2


.
********

Group: WDG Moderators
Posts: 9,656
Joined: 10-August 06
Member No.: 7



There are three STYLE elements (only one is necessary), but the last CSS code is outside any of them.


Also a few sidenotes:

- IMG elements should almost always have an ALT attribute, even if it's empty.

- It's good practice to specify text color and background at the same place.

- It's more practical to avoid inline CSS (the STYLE attribute), put all CSS in STYLE elements (or external stylesheets) instead.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
pandy
post Oct 7 2018, 08:22 PM
Post #3


🌟Computer says no🌟
********

Group: WDG Moderators
Posts: 20,730
Joined: 9-August 06
Member No.: 6



IMG elements should almost always have an ALT attribute, even if it's empty.

tongue.gif

The short.
https://www.w3.org/QA/Tips/altAttribute
The long.
http://jkorpela.fi/HTML/alt.html
Specifically about when and why empty an empty alt can be a good thing.
http://jkorpela.fi/HTML/alt.html#empty
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Christian J
post Oct 8 2018, 05:29 AM
Post #4


.
********

Group: WDG Moderators
Posts: 9,656
Joined: 10-August 06
Member No.: 7



QUOTE(pandy @ Oct 8 2018, 03:22 AM) *

IMG elements should almost always have an ALT attribute, even if it's empty.

HTML5 has loosened that requirement under very specific circumstances: https://www.w3.org/TR/html/semantics-embedd...-of-publication (I am nitpicking here tongue.gif tongue.gif ).

But in the case of the OP, the IMG element probably should have an empty ALT, since it seems to be a decorative image.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
pandy
post Oct 8 2018, 07:09 AM
Post #5


🌟Computer says no🌟
********

Group: WDG Moderators
Posts: 20,730
Joined: 9-August 06
Member No.: 6



You should still provide a text alternative, only in another way, through figcaption. Which, I think, is a level or two above where the OP is at.

I don't see their point BTW. If you can't provide an alt text, in what way is it easier to produce a figcaption text? And the last point there is totally incomprehensible to me.
CODE
* Ignoring the figcaption element and its descendants, the figure element has
no Text node descendants other than inter-element white space, and no embedded
content descendant other than the img element.


But we are straying form the topic at hand. Sorry, msa969.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Christian J
post Oct 8 2018, 11:00 AM
Post #6


.
********

Group: WDG Moderators
Posts: 9,656
Joined: 10-August 06
Member No.: 7



Digression follows!

QUOTE(pandy @ Oct 8 2018, 02:09 PM) *

I don't see their point BTW. If you can't provide an alt text, in what way is it easier to produce a figcaption text?

Writing a caption text might be more intuitive for most users (like in the "Eloisa with Princess Belle" example), while proper ALT texts are often misunderstood even by web developers. And it seems even image meta data can be used for the FIGCAPTION, something that a file upload script can handle automatically.

But ALT text is of course the norm:

CODE
"If there is even the slightest possibility of the author having the ability to provide real alternative text, then it would not be acceptable to omit the alt attribute."


QUOTE
And the last point there is totally incomprehensible to me.
CODE
* Ignoring the figcaption element and its descendants, the figure element has
no Text node descendants other than inter-element white space, and no embedded
content descendant other than the img element.

I think they mean that in this special case (of ALT omission), the FIGURE element can only contain an IMG and a FIGCAPTION element.

QUOTE
But we are straying form the topic at hand. Sorry, msa969.

blush.gif
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
pandy
post Oct 8 2018, 12:04 PM
Post #7


🌟Computer says no🌟
********

Group: WDG Moderators
Posts: 20,730
Joined: 9-August 06
Member No.: 6



QUOTE(Christian J @ Oct 8 2018, 06:00 PM) *

Writing a caption text might be more intuitive for most users (like in the "Eloisa with Princess Belle" example), while proper ALT texts are often misunderstood even by web developers. And it seems even image meta data can be used for the FIGCAPTION, something that a file upload script can handle automatically.


And why couldn't that phrase be an alt text? Besides, alt is meant for the convenience of the user, not the author.

But I really think we should stop this discussion now. Or start another thread about it.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Christian J
post Oct 9 2018, 05:44 PM
Post #8


.
********

Group: WDG Moderators
Posts: 9,656
Joined: 10-August 06
Member No.: 7



QUOTE(pandy @ Oct 8 2018, 07:04 PM) *

And why couldn't that phrase be an alt text?

It might be in some cases, but I don't think users uploading images would know if/when that's the case. Keep in mind that an ALT text is "an appropriate functional replacement for the image" - it's not a caption text. "Eloisa with Princess Belle" would be a good caption text though, and I think users uploading images understand the concept of captions better than ALT, so the HTML5 spec does makes sense to me here (in its convoluted way).

QUOTE
But I really think we should stop this discussion now. Or start another thread about it.

As long as I get the last word. laugh.gif

User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
pandy
post Oct 10 2018, 12:44 AM
Post #9


🌟Computer says no🌟
********

Group: WDG Moderators
Posts: 20,730
Joined: 9-August 06
Member No.: 6



I confess I hadn't noticed the cases with user upload. That makes sense. Otherwise I still think it's rather pointless.

I don't mind digressions. I'm guilty of a few. That's often what makes things interesting. Just not when it complicates a newbie thread.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post

Posts in this topic


Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



- Lo-Fi Version Time is now: 25th April 2024 - 04:17 PM