Forum Moderators: not2easy
<!--Force IE6 into quirks mode with this comment tag-->
<!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" lang="en" xml:lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Party Plan-It Mobile DJ Services</title>
<style type="text/css">
body, html {
text-align: center;
body-top: 0;
margin: 0;
padding: 0;
}
body {
background: url(images/master03_800.jpg) white center top no-repeat fixed;
background-color: #EEDDDD;
min-width: 800px;
}
#wrapper {
width: 800px;
margin: 0 auto;
padding: 0;
text-align: left;
}
#menuwrapper {
float: left;
Width: 800px;
height: 50px;
padding: 0;
margin: 0;
}
.menubutton {
float: left;
width: 135px;
height: 35px;
padding: 0;
margin: 0;
}
#logo {
float: left;
width: 200px;
height: 160px !important; /* IE is ignoring this line, thie image the div contains is about 200px tall */
padding-left: 0;
padding-right: 0;
padding-top: 0;
}
</style>
</head>
<body>
...
<div id="menuwrapper">
<div id="menuspace" style="float:left; width: 800px;height: 4px; font-size: 2px;"></div>
<div id="menuspace" style="float:left; width: 240px;height: 38px;"></div>
<div class="menubutton">
<div class="cssbutton"><a href="indexnew2.htm"><img src="images/buttons/CosmicGelLa0.gif" alt="Events" /><span>Events</span></a></div>
</div>
...
</div>
<div style="z-index: 21;" id="logo">
<span><img src="images/PPlanitLogo.png" style="position: relative; width: 200px; top: -35px; left: 30px" alt="text"/></span>
</div>
Any other thoughts?Always Plenty ;)
I'm trying to place objects on my page using divsTo me, this is the root cause of the troubles: Css styles html elements. While it is quite possible to create and style a page filled with "containers" (imagine a page styled to look like a chess board), that's not much help as the goal is to deliver your content.
css
div {
/*styles for example*/
width:90%;
margin: 0 auto;
background-color:#aaa;
/* set a position to make it easy to position the logo */
position:relative;
}
ul {
/*create the bar */
width:90%;
height:50px ;
margin: 0 auto;
/*styles for example */
background-color:#ccc;
list-style-type:none;
}
li {
/*styles for example */
width:30%;
float:left;
text-align:center;
line-height:30px;
border:3px solid #eee;
}
img {
/* position the image*/
position:absolute;
/* move as desired*/
margin-left:100px;
margin-top:-10px;
}
html
<div>
<ul>
<li><a href="">Menu</a></li>
<li><a href="">Menu</a></li>
<li><a href="">Menu</a></li>
</ul>
<img src="myimage.jpg" width="100" height="40" alt="My alt" >
</div>
Hi flyingscool, and welcome to WebmasterWorld :)
To me, this is the root cause of the troubles: Css styles html elements. While it is quite possible to create and style a page filled with "containers" (imagine a page styled to look like a chess board), that's not much help as the goal is to deliver your content.
I'm not sure why you are coding xhtml and deliberately forcing quirks mode as am not sure if you really want all the issues created by quirks, especially in ie6.
Soooo.... putting all that together, I wonder if your menu is a really a list, and can be marked-up as such in the html. That provides the opportunity to create a taller <ul> to create a "bar", then position the logo image over that bar. All wrapped in a div to lock it together.
I removed the quirks line and it fixed some issuesI'll bet it did :)
Regarding XHTML-I'm not sure either; I got the code as the basis of an example of how to centre my background on the page, and it said to use that Doctype declaration.Excellent example of the implications of not separating content (marked up by html) and style (css): The solution you copied adjusted the html (by triggering quirks mode) to deal with a layout (style) issue.
Although I must say, in my mind, I think that padding should shrink the container, not expand the container around the contents.The subject of much heated argument for years! Not much can be done about legacy versions, but after all the debate, css3 introduces box-sizing - so you can choose and use whichever you prefer :)
I guess I should learn more about the differentiation between html elements and CSS styling ...Good on you - and look how many different html elements [w3.org] there are. Unlike divs, all convey a real meaning! I expect by now you'll understand the demarcation: HTML to mark-up the content in a meaningful way, css (style) to suggest how the content should be displayed to the user.
Creating containers was the easiest way for me to think about how to orient my objects on the page without having to look at each object and calculate its absolute location.At first that sounded like the "grids" approach, now I wonder if the language is drawn from your programming background. If so, think of html elements (a para of text, image) as the "objects". You're right to avoid trying to code a location for each one - it's fairly impossible given all the possible combinations of platform/device and user agent anyway. So reduce the workload by marking-up with semantic html to utilise the intrinsic meaning and default styles. To manipulate the "objects" efficiently, put them in "containers" - as you say.
My goal here is to plop some stuff on the page where I want it to go. So, to get this to work, my thought was to create a bunch of boxes ...If you build boxes, then add elements, then apply style and things don't "work", you have to delete the css, remove the elements and rebuild the boxes to start again. I suggest the opposite: Html elements are already boxes/rectangles. Mark-up the html semantically, then open your style sheet editor and push the existing elements around. If the design doesn't work, change the css.
Not to mention the fact that absolute doesn't work relatively from the location of its container ...Correct, but it does if the containing block (your "container") has position:relative - see it working in the posted example.
... and relative doesn't always work absolutely from the coordinates of the container, (I think it takes other objects in the container into account?).Yes - the element remains in the flow and is positioned "relative" to it's original location "relative" to those other elements.
And you can't mix a relative dimension with a float, like float left 4px from the top of the container.Yes, and two important points: top/left/etc only work if there is a position other than the default static. Floats are quite different but do obey margins that can be used to "position" them in relation to other elements.
Is there an advantage to using a list over the method I used?As above, <ul> is a natural container for <li>'s and they can be added/removed and styled as you want. However, given the design description, now I'm not sure: If you have a "balloon" affect another approach might be needed. Links aren't really encouraged, but this sounds really interesting and fun - could you sticky me a url to a draft so I can take a look and bring back the relevant html?
... Basically, I was looking for a good way to make a container, and then be able to easily add or remove buttons ...