I am using css to display my background image. As you can see from the attached file, the image is a blue fading to white then back to blue.
The image is 1920 x 1080 pixels. I have had to shrink it to upload it though.
I need the image to sit horizontally between the two edges of the browser.
All I am getting at the mo is the left part?
http://www.tigltd.com/v3
Any ideas?
Centauri
09-21-2007, 09:54 AM
body {
width: 100%;
background: white url(http://www.tigltd.com/v3/images/bg.gif) no-repeat center top;
font: 70% Arial, sans-serif;
}
I would also recommend making the graphic much shorter, say 10px high, and changing the style to:body {
width: 100%;
background: white url(http://www.tigltd.com/v3/images/bg.gif) repeat-y center top;
font: 70% Arial, sans-serif;
} This will result in faster image load
peteyb
09-21-2007, 10:07 AM
this still does not accomplish the blue sitting against either side of the browser?
Centauri
09-21-2007, 10:11 AM
If you want the blue fade effect starting from each side and fading towards the centre, you will need two images, one for left and one for right. This will require a wrapper div surrounding the whole site to apply the second image to, though.
peteyb
09-21-2007, 10:32 AM
is this good coding practice?
if so how do you do it?
Centauri
09-21-2007, 10:49 AM
Bit hard to test and advise when the images don't seem to exist on the server....
You need to apply one image to the body and the other to the #back div
peteyb
09-21-2007, 11:10 AM
the images are bg1.gif for the left and bg2.gif for the right.
Webnerd
09-21-2007, 11:51 AM
It is actually better to establish a fixed horizontal width and center your content nowadays since monitors are getting so huge. You don't want a paragraph that reads from left to right with 1000 characters, it would be impossible to read.
It is nice that some sites will expand full screen but this can also create huge areas of empty and useless real estate on the page.
Centauri
09-21-2007, 06:38 PM
The #back div is not expanding past the header as you need to clear the floated contents - the overfow property can do that. You also need to not specify a background colour for #back, as this will cover the body background.div.back {
overflow: hidden;
background: url(http://www.tigltd.com/v3/images/bg2.gif) repeat-y right top;
}The images are also way too wide - if you want the page to be able to work down to 800px screens, each image should be no wider than about 390px.
kiwibrit
09-21-2007, 06:38 PM
It is actually better to establish a fixed horizontal width and center your content nowadays since monitors are getting so huge.....
I think there is a case for using max-width (supported by IE7) - though I suspect many high-resolution monitors use a smaller window for browsing the web. If max-width is set at a reasonably high value, and you are using margin:0px auto; for centering, there is no need to worry about IE5, since the residual users of that browser are unlikely to have a monitor that would cause them the problem.
peteyb
09-24-2007, 06:33 AM
many thanks for the advice.
i have implemented Centauri's option but now the image stops repeating after my second text div.
http://www.tigltd.com/v3
peteyb
09-25-2007, 10:49 AM
any ideas guys
Centauri
09-25-2007, 11:04 PM
To get the back div to be a minimum 100% height of the screen, it needs to reference that 100% to the height of its parents, the body and html, neither of which have a reference height set. Therefore setting the height of body and html to 100% first will give that reference. As you need the height of the back div (that is really a bad name - I would call it "wrapper", and make the name an id rather than a class) to be a minimum height of 100%. As IE6 doesn't understand that, it needs to be fed the 100% height through a * html hack.
I also mentioned that the width of the background graphics needs to be such that you don't get an overlap on smaller screens - a cropped version of bg2 is attached here.
Besides all that, there are numerous other problems - the footer overlaps content when content is long or screen size is small, the right column drops when screen size is smaller, the menu is a complete mess in FireFox, and doesn't drop in IE6....
Turning first to the footer, absolute positioning does not work as it is then not pushed down by the content if necessary. It needs to be outside the #wrapper (I will call it that now), and have a negative top margin applied to pull it back over the bottom of #wrapper to sit at the bottom of the screen. To do this, it needs to be one div with a defined height. Your existing #footer and #bottom divs can be easily combined into one, containing only the ul and a paragraph for the bottom text, eleiminating a number of divs and id's in this area. As this can overlap the content, a padding div can be placed after the floated columns to both clear the floats and provide the necessary space for the footer.
The content columns are a problem due to the mixture of em-sized margins and % size of the divs - at smaller screen sizes, the total width is more than 100%. This can be addressed by giving the margins in % values, and defining the margins in the centre to be zero. Next, your content consists or headings and paragraphs - so mark it up that way. This eliminates the <br>s, the not widely supported :first:line psuedo class, and a few more divs.
The menu doesn't work as you probably designed it relying on IE's bugs (yes, that includes IE7). An inline element like an <a> cannot be given a width - it must be set to block level for that. The easiest way is to float the <a>s left (which also gets around IE6's buggy behaviour using blocks inside inline <li>s), and floating the <li>s as well. The <ul> can then be assigned a width and given auto side margins to centre it.
The revise html I came up with is :<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
PS: Now all you need to do is get the menu hover working in IE6 - I would suggest the suckerfish method.
peteyb
09-26-2007, 04:21 AM
I dont know where to start, thank you.
1. I had heard of "hacks" but did not understand their meaning or implementation - are there any other widely known hacks that are needed for day to day CSS development?
2. How can I install IE6 and IE7 on the same PC?
3. Thanks for the advice on the footer, I will etch this method into my brain for future!!
4. The method I used for this drop down was a mixture of niftyCube (for rounded corners) and Suckerfish (for the hover drop down). I think that there must be some duplication of code or I have deleted something which is causing IE6 problems.
Regards
Peter
Centauri
09-26-2007, 05:51 AM
I see the suckerfish javascript now in the navHeader.js file. i think the problem may be in the niftycube javascript onload() over-riding the suckerfish onload() - you may need an onload() function to run both scripts. As I am not really a javascript person, it may be wise to ask the question on the javascript forum.
A "hack" is just a method of doing something non-standard that can target particular browsers. In the case of IE6, it thinks there is another wrapper outside of the html element, so it can be targeted using * html. meaning an html element within any other element - "proper" browsers will ignore this as it doesn't make sense, but IE6 will happily accept it.
Here (http://tredosoft.com/Multiple_IE) is one article on running multiple versions of IE.
Some other articles on IE hacks are here (http://www.positioniseverything.net/explorer.html) and here (http://www.howtocreate.co.uk/wrongWithIE/)
peteyb
09-26-2007, 06:42 AM
Im begining to understand why developers do not like IE!!!!
Do you not think the font quality looks better in IE though?
The drop downs are working in IE6 but with a sligh defect - there is a visible gap between the li and the border. Any ideas?
peteyb
09-26-2007, 06:53 AM
also, how are you able to see inside my stylesheet references, these details are not displayed in the view source option
Centauri
09-26-2007, 07:19 AM
There is also a problem in FF where the dropdown border is only on the left side. As you have increased the <a> width to 15em, this also needs to be applied to the dropdown <ul>s - IE incorrectly expands the <ul>s to fit the content. As IE expands the <ul>, it also then makes room for the right padding inhereted from the top <li>s, so we also have to get rid of that :#nav li ul, #nav li ul ul {
display: none;
position: absolute;
padding: 0 0;
width: 15em;
border: 1px solid #09539e;
left: -1px;
}
#nav li li {
height: 2.4em;
line-height: 1.5;
font-size: 1em;
text-transform: capitalize;
margin: 0;
}
To view the css without any other tools, from the view source it is simply a matter of copying the css url and pasting in the browser bar. I use the Web Developer Toolbar addon for FireFox, so a click on an icon and view css displays all the css files active.
peteyb
09-26-2007, 08:46 AM
yet again, thanks.
one last bit of help if you dont mind. I have added a second level drop down on the home insurance tab.
It works in IE7, FF and Opera but not IE6?
webdeveloper.com
Copyright Internet.com Inc., All Rights Reserved.