Using CSS Styling, for first time... (putting custom border around outside)
ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Using CSS Styling, for first time... (putting custom border around outside)
Okay, so i'm working on a website and trying to use CSS styling to accomplish this, now I'm fairly new to using css styling so i' need some help, anyhow, this is my html code
What I am trying to do is wrap a border around the page, have a div in the center with a div at top with banner and left with navigation.
Like i drew out below.
Now, i'm running a demo of the site off of http://alhashmi.mjmxdesign.com/page1.html
The problem is that it displays incorrectly in IE7 - mozilla seems to read it fine. So, I need to know of an easier or alternative method to do this that works, or some help fixing up the code. I'm just having a hard time layering this up correctly, anyhow, any help that can be offered would be greatly appreciated.
Thanks,
MJ
Last edited by mitchell7man; 04-07-2009 at 12:24 PM.
Distribution: Debian /Jessie/Stretch/Sid, Linux Mint DE
Posts: 5,195
Rep:
Don't be surprised if your page look different in the MS browsers. There are "standard compliant" browsers like Firefox, Mozilla, Opera, and those which are not, i.e. IE6 and IE7. IE8 seems to be compliant and users are complaining because all script kiddies in the world write IE6 and IE7 compliant code without knowing it is different.
Complete books have been written about how to write CSS code which is partially ignored by IE but understood by Mozilla and the other way around so you can cheat. There are so many cases and examples, Google is your friend here.
I can't dive into your code right now, but the best way to do overlapping DIVs is by positioning them absolute instead of relative. All other variants try to tile the DIVs in certain ways. Absolute works fairly in all browsers but it is pixel calculation hell.
I haven't seen z-index before, check w3c.org to see if IE understands it.
Hmm, i'll have to look more into that, but my problem is that I do need the site to be viewable in IE, considering that so many people use it. - If I use position absolute, how do I ensure that the page would be centered on different screen resolutions?
-If I have a relative frame centered, (margin left right top bottom - as auto) and absolute frames inside, will they align inside of the main frame? - I'm not sure if i make sense. Anyway, any help you can offer I will appreciate... -- or if I have absolute frame is there such thing as outo margining it into the center?
Distribution: Debian /Jessie/Stretch/Sid, Linux Mint DE
Posts: 5,195
Rep:
OK, I got a wrong understanding what you meant with "overlapping". As long as you place one DIV inside the other, you are fine, and you can stack as many DIV on top of each other as you like, as long as the parent DIV fully encloses the child DIV.
Now there are few errors in your style definition. Those are treated differently by various browsers. Some ignore the errors, some ignore the entire class or id.
For example:
Then, the next step is to put a thin border around ALL your DIVs so you can see what you are doing. Leave the DIV empty except for a string which writes the class or id name of the DIV so you can see what is what.
Then put in one single DIV at a time in your code and view it in various browsers. Usually you only need 3 or 4 or so, you'll get the hang of what browsers display equally.
Lat but not least, take into account that IE counts the OUTSIDE dimensions of a DIV, that is including margins and borders, while others count the inside of a DIV and add borderwidth and margins to that. If you try to float two DIVs in a parent DIV using exact dimensions, you'll see awkward differences in the two browsers.
Distribution: Debian /Jessie/Stretch/Sid, Linux Mint DE
Posts: 5,195
Rep:
Quote:
Originally Posted by pg99
Personally I would just use tables, but then I'm old-fashioned :-)
I don't think it has something to do with old fashioned. Depends on you presentation needs. I have written quite a few tabular overviews using tables, and I am still figuring out how to get it all right in all browsers.
For a simple 3-column overview where all layout is right as long as it contains all data, there is no problem. But if you want to put a lot of data in a confined space and you want exact alignment, no columns getting squeezed to 10 pixels etc, using DIVs inside cells, it is difficult.
Eventually I ended up with writing my CSS in PHP, taking into account all IE6 quirks in effect for my page. Now it looks right down to the pixel in all browsers. But it was hard.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.