Jump to content

Html Code Versus Div Tag


amitamberker

Recommended Posts

maybe just try margin: 0 auto?
Hi thescientist,Just now tried that. Still it's left aligned... wheww...
Link to comment
Share on other sites

  • 10 months later...

Hi Deirdre's Dad and Others,How do I place the "<div>06</div>" under the following code?<a href="xyz.html"><div class="floatLeft"></div></a><a href="xyz.html"><div class="floatRight"></div></a>HTML FILE

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><title>Test</title><link rel="stylesheet" type="text/css" href="stylesheet.css" /></head><body bgcolor="#1a1a1a" style="margin-top:0px;margin-bottom:0px"><div id="container"><div class="center">01</div><div>02</div><div class="center">03</div><div>04</div><a href="xyz.html"><div class="floatLeft"></div></a><a href="xyz.html"><div class="floatRight"></div></a><div>06</div></div></body></html>
CSS FILE
div#container { width: 800px; margin: 0 auto;}div.header01 { height: 21px; background-color: #d3c9b8;}.center { text-align:center;}.floatLeft { float: left; background-image: url('images/previousbutton.png'); width: 122px; height: 32px; background-repeat: no-repeat;}.floatRight { float: right; background-image: url('images/nextbutton.png'); width: 122px; height: 32px; background-repeat: no-repeat;}
Link to comment
Share on other sites

Hi Ingolme,Thanks for your response. I thought Deirdre's Dad would respond :) but No Worries :)

You can add clear: both to the style of the element in order to make it go below floated elements.
Perfect! It worked :) Thanks a lot Ingolme. I appreciate!
But you should validate your code, there are too many mistakes. http://validator.w3.org/
Well - I have no idea how to fix the mistakes. Could you please help me to fix those mistakes? But however, that is not the EXACT code. The EXACT code is confidential since it has Google AdSense Code and YouTube Code.
Link to comment
Share on other sites

The main problem is that you're putting a <div> element inside an <a> element.Just apply the class to the <a> element and add display: block to the CSS:

<a href="xyz.html" class="floatLeft"></a><a href="xyz.html" class="floatRight"></a>

a.floatLeft,a.floatRight { display: block; }

Link to comment
Share on other sites

The main problem is that you're putting a <div> element inside an <a> element.Just apply the class to the <a> element and add display: block to the CSS:
<a href="xyz.html" class="floatLeft"></a><a href="xyz.html" class="floatRight"></a>

a.floatLeft,a.floatRight { display: block; }

Hi Ingolme,If I remove / delete the <div> element inside an <a> element, then those 2 buttons will get messed-up? HUM! What do you think?
Link to comment
Share on other sites

Hi Ingolme,I thought the Buttons would get messed-up. But they are still perfect. I removed the <div> element inside an <a> element and applied the class to the <a> element and added display:block to the stylesheet.css file.Thanks a lot!

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...