Jump to content

Placing text example in div class


WhyCanY3s
 Share

Recommended Posts

Good day every one I have a problem that I have come up against and I need help over it, would love to get my head around it by the end of this half term break as the assignment needs to be in by the first week back at college.To the point, the assignment is to concept design a basic html web page with one external link and four internal links, that side, I have scripted out on paper, however the theme of the page is "creating a Simple HTML Document and Viewing it".I wish to place a div class between two <li></li> tags in a order list, html code below:<u>Task 2.1</u><br/><ol><li>In the text editor window type in the following text:</li><div class="code_container"> <html><body>The content of the body element is displayed in your browser.</body></html></div><li>The text you have entered in the above section of code includes brackets "<>", these part of the code is called HTML Tags</li><li>Save the text document, as test.html in your Web Dev Folder</li><li>Open your web browser (Internet Explorer), and go to File, Open, Browse</li><li>Search for the file you have just saved ( remember you have just saved it as a HTML file) </li><li>Open it</li><li>You should now be looking at a page similar to this</li></ol>However even with the css script in place below:.code_container { position: ; width:220px; padding:10px; border:2px solid gray; margin:0px; }It is not the desired effect that I had wished for as the only part of <div class="code_container> shows up with in the page is the explanation statement.Any help in this would be very greatfull

Link to comment
Share on other sites

For starters, you can't place text directly inside an <ol> or <ul>. It must be contained within an <li> tag.Second, if you want the actual code to show up on the page, you need to encode the '<' symbols, otherwise the browser will just parse it as markup. You use < in place of < to encode those. While not really necessary, I also recommend you encode the '>' symbols too. (>)

Link to comment
Share on other sites

If you want HTML to be readable, use this entity place of your opening < brackets: <Also: nothing can come in the space between list items. There's no telling where in the document a browser will position such stuff.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...