Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 12 of 12
  1. #1
    Registered User
    Join Date
    Oct 2008
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts

    HTML for PHP Databases (Firefox CSS help)

    Right, so to help me with this, you need to know at least a little bit about databases because otherwise I'll get resonses that won't help me in the least.
    So when you code for the template where your database content will be displayed, you code for one of the entries and the code around that and the PHP will automatically use the same code for every entry in the linked database. Basically, what that means is you can only code for one entry.

    I am making a page where web icons will be displayed. I need to make it so four web icons will fit from left to right.
    Basically, I have divs surrounding each icon because it's the icon on top, and three lines of text below (all generated by the database). I need the divs to line up next to each other so that they go four across. I figured out how to do it perfectly in Internet Explorer (feel free to check out the page at http://sayarynth.com/content/avatars/).
    If you look at it in IE, it shows it exactly how I want it.

    Basically, I want it to look like the following (this is the main content area):
    _________
    ==Avatars
    |*|*|*|*|
    |*|*|*|*|
    |*|*|*|*|
    |*|*|*|*|
    __1_2_3__

    The numbers at the bottom represent the page numbers that I have generated with a PHP code.
    So, I only code for the first little |*| box. Pretend that's the icon with the text and everything.
    Right now, my code looks like:
    (tags are replaced with brackets)

    AVATAR INDEX PAGE

    [code to PHP layout head]

    [HEADER] Avatars

    [code that links to database]

    <span class="icon">
    <img src="<?php echo "$icon"; ?>"><br>
    <b>#<?php echo "$id"; ?></b><br>
    <?php echo "$name"; ?><br>
    <?php echo "$date"; ?>
    </span>

    [code that ends the database linking]

    <center>
    [code for pages #s]
    </center>

    [code to PHP layout footer]


    And the CSS for the class="icon" looks like:

    .icon {
    background-image:url('icon.png');
    background-repeat:no-repeat;
    background-position:center center;
    text-align:center;
    height:140px;
    width:120px;
    margin:2px;
    text-size:10px;
    line-height:10px;
    letter-spacing:-1px;
    }


    So, with this coding (because the code may be different by the time you look at the pages) it looks like this in each browser:

    INTERNET EXPLORER (bless its soul)
    _________
    ==Avatars
    |*|*|*|*|
    |*|*|*|*|
    |*|*|*|*|
    |*|*|*|*|
    __1_2_3__

    (this is how I want it to look)

    FIREFOX (damnation!)
    _________
    ==Avatars
    |*|
    |*|
    |*|
    |*|
    |*|
    |*|
    |*|
    |*|
    |*|
    |*|
    |*|
    |*|
    |*|
    |*|
    |*|
    |*|
    __1_2_3__


    You get the idea. Any advice?
    Do you know any way I can get divs to lay up next to each other?
    Last edited by Apostropartheid; 11-29-2008 at 03:29 PM. Reason: Reverted to original post.

  • #2
    Regular Coder
    Join Date
    Apr 2008
    Location
    Manila, Philippines
    Posts
    263
    Thanks
    3
    Thanked 12 Times in 12 Posts
    of course it will look that way... cause you didnt float each element you echo.. thats why it's vertically displayed not horizontally...

    Code:
    float: left;

  • #3
    Regular Coder
    Join Date
    Nov 2005
    Posts
    329
    Thanks
    3
    Thanked 19 Times in 19 Posts
    The divs as default place themselves one under the other as a div is a block element (takes the full width of the container div). If you want another div to be placed at the right of the div use:
    float:left; clear:right

    It is explained nicely here:
    http://webdesignfromscratch.com/css-...and-inline.php

    Incidentally, IE happens to be the worst browser around, so it would be better to code for a web compliant browser (FireFox, for example) where it will work as it should on all other web-compliant browsers, except IE, and then tweak your IE with conditional statements and separate stylesheets.

  • #4
    Senior Coder
    Join Date
    Oct 2005
    Posts
    1,340
    Thanks
    0
    Thanked 61 Times in 60 Posts
    Quote Originally Posted by Avril View Post
    Incidentally, IE happens to be the worst browser around, so it would be better to code for a web compliant browser (FireFox, for example) where it will work as it should on all other web-compliant browsers, except IE, and then tweak your IE with conditional statements and separate stylesheets.
    This is a very correct and important note to remember.
    I figured out how to do it perfectly in Internet Explorer
    This means nothing when coding for the web.

  • #5
    Registered User
    Join Date
    Oct 2008
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Well, the "float:left; clear:right" sucessfully lined up the avatars correctly however the page numbers were then squished in the right margin for some reason and it no longer works in IE.

    I've spoken to web designers who do this for a living and they all agree that Firefox is much worse for coding than IE so thank you for your opinion but I think I'll keep coding for BOTH IE and Firefox. It's important that it works in both because the majority of web users still use IE as their main browser, for a reason. So, yes, it means everything when coding for the web.

    For now, I'm saying this is resolved. I'll talk to a friend who has done this before. Thank you for the suggestions. I think they're on the right path but it'll take more fiddling to make it exactly right.

  • #6
    The Apostate Apostropartheid's Avatar
    Join Date
    Oct 2007
    Posts
    3,215
    Thanks
    16
    Thanked 265 Times in 263 Posts
    Quote Originally Posted by Sayarynth View Post
    I've spoken to web designers who do this for a living and they all agree that Firefox is much worse for coding than IE so thank you for your opinion but I think I'll keep coding for BOTH IE and Firefox. It's important that it works in both because the majority of web users still use IE as their main browser, for a reason. So, yes, it means everything when coding for the web.
    No one is saying that IE is unimportant. The poster implies that if you've done it right in IE but other browsers are harder to beat down, then you're most likely doing something wrong (but not always, as I've discovered a couple of times to my great displeasure.)

  • #7
    Master Coder
    Join Date
    Apr 2003
    Location
    in my house
    Posts
    5,211
    Thanks
    39
    Thanked 201 Times in 197 Posts
    Welcome to CF.

    Quote Originally Posted by Sayarynth View Post
    Right, so to help me with this, you need to know at least a little bit about databases because otherwise I'll get resonses that won't help me in the least.
    Actually, we simply need to see your html output, preferably with a link.


    Quote Originally Posted by Sayarynth View Post
    I've spoken to web designers who do this for a living and they all agree that Firefox is much worse for coding than IE so thank you for your opinion but I think I'll keep coding for BOTH IE and Firefox.
    I think that statement should help you to identify who the professionals are then and, more importantly, who they aren't. Like, some people around here don't code for a living
    (think Aero and others [no offence to those not mentioned]). The advice you have received in this thread, is from professionals either directly or indirectly.

    It is a widely known fact amongst professionals (real ones here in CF), that you code for a standards compliant browser and then tweak for IE. Saying that FF is much worse than IE simply shows ignorance/inexperience and, it is likely that those coders you speak of do it the wrong way around - hence their assertion that FF is more difficult.

    Quote Originally Posted by Sayarynth View Post
    so thank you for your opinion but I think I'll keep coding for BOTH IE and Firefox. It's important that it works in both because the majority of web users still use IE as their main browser, for a reason. So, yes, it means everything when coding for the web.
    If you code for IE firstly, then it will be a harder task to get all browsers compatible. This has nothing to do with preferring IE over FF or vice versa. It is important to have IE and FF and others show the page as designed. the coders here are telling you how easiest to achieve that end result.

    For now, I'm saying this is resolved. I'll talk to a friend who has done this before. Thank you for the suggestions. I think they're on the right path but it'll take more fiddling to make it exactly right.
    The help is freely available here (far from it being for me to say), and again, you are welcome.

    But, if you think the people offering you help here aren't professional or experienced enough, then it is your choice whether you should post. (take a look through the search facility to see how good they are).

    I would suggest that if, in your post, you deem them not to be good enough, you will likely alienate them and find fewer responses.

    They are worthy of respect especially when you might consider they give of their time freely for the likes of us. SO thank you for your post which has given me the opportunity of expressing my gratitude to all at CF.

    (ps. I am not one of the pros so I am not offended by your post).

    bazz
    Last edited by bazz; 11-28-2008 at 07:20 PM.
    "The day you stop learning is the day you become obsolete"! - my late Dad.

    Why do some people say "I don't know for sure"? If they don't know for sure then, they don't know!
    Useful MySQL resource
    Useful MySQL link

  • #8
    Senior Coder
    Join Date
    Oct 2005
    Posts
    1,340
    Thanks
    0
    Thanked 61 Times in 60 Posts
    I AM one of the pros who make a substantial living from this and, therefore, the experience to know better but I will withhold my comment about the so called 'experts' he got advice from and ditto what bazz and others said above. I would like his so called experts come here and face us one-on-one and see where their true knowledge lies.

  • #9
    The fat guy next door VIPStephan's Avatar
    Join Date
    Jan 2006
    Location
    Halle (Saale), Germany
    Posts
    8,729
    Thanks
    6
    Thanked 1,015 Times in 988 Posts
    Quote Originally Posted by Sayarynth View Post
    For now, I'm saying this is resolved. I'll talk to a friend who has done this before. Thank you for the suggestions. I think they're on the right path but it'll take more fiddling to make it exactly right.
    Honestly, if you had just shown your output source code (the HTML you see when viewing the source code in the browser) then this would probably just be a matter of minutes to solve. bazz has said in a very formal way what Iím thinking right now in a very colloquial manner.

    Fact is: if so-called professional web designers tell you that itís much harder to code for Firefox than for IE then Ė and Iíll tell you my very personal and honest opinion Ė they should really give up their job because theyíre just not in the position to call themselves professional web designers. They might be good graphic designers (I canít tell since I donít know them) but a good web designer/developer wouldnít say itís harder to code for Firefox than for IE. If that were the case then they would also fail at Safari, Opera, Konqueror, and Google Chrome (among many other browsers which you have to consider when you call yourself a professional web developer).

    So, without getting all worked up about that subject Iíll say this in a nutshell: If Internet Explorer displays a website in a certain way and Firefox, Opera, Chrome, and Safari display it differently (but the same difference) altogether, who do you think is wrong? Or to make it even more clear: Itís not at all hard, even for developers who donít do that for a living, to code websites for all browsers. And itís also a fact that Opera, Firefox, and Safari (to name just the major browsers) are commonly called standards compliant browsers because they follow the standards established by the World Wide Web Consortium pretty closely while Internet Explorer is definitely not considered very standards compliant (anymore). Or, to let no doubt: Internet Explorer is the worst browser currently in major use.

    So, please believe what the knowledge base from all around the world (= this forum) is telling you:
    You should code websites in (X)HTML strict and with standards compliant browsers (Safari/Opera/Firefox/Google Chrome) as primary testing grounds.
    Chances are that if the website looks good in those standards compliant browsers it may also look good in IE. And those issues that IE has (because itís just wrong in its interpretations of the source code!) can be fixed with alternate styles if necessary. But as said: if a website is coded correctly then chances are that you wonít even need alternate styles for IE.

    So, to repeat in a nutshell: The people who told you that crap about how itís harder to code for Firefox than for IE are no good web developers. Because if they were that issue you were posting here wouldnít even be worth the time you spent typing it.

    So, please donít go away thinking that we are stupid and canít solve your problem. Post your HTML and we can help you.

  • Users who have thanked VIPStephan for this post:

    FWDrew (11-28-2008)

  • #10
    Regular Coder FWDrew's Avatar
    Join Date
    Apr 2008
    Location
    Missouri
    Posts
    380
    Thanks
    38
    Thanked 45 Times in 43 Posts
    Fact is: if so-called professional web designers tell you that it’s much harder to code for Firefox than for IE then – and I’ll tell you my very personal and honest opinion – they should really give up their job because they’re just not in the position to call themselves professional web designers.
    I agree completely. To the OP, some wise words: "Build it for Firefox, hack it for IE"

    Drew
    Dev-Tips.com || Employee at the Envato Network || My Portfolio

  • #11
    Registered User
    Join Date
    Oct 2008
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I didn't mean to offend anyone. I thought I gave all the right codes.
    I'm not going to my friend for help because I think anyone here is unprofessional or can't figure it out but because after someone gave a suggestion, a couple of posters started getting into browser preference. I never gave my preference, I was simply saying nothing I was doing was working in Firefox when a lot of things I did worked in IE. I don't appreciate the war over browsers. This post was never about which browser reads code better. It was about making my code compatible in both of them, despite which one is better. I appreciate the posters who gave good suggestions.
    This thread is done.
    Last edited by Sayarynth; 11-29-2008 at 02:48 AM.

  • #12
    The fat guy next door VIPStephan's Avatar
    Join Date
    Jan 2006
    Location
    Halle (Saale), Germany
    Posts
    8,729
    Thanks
    6
    Thanked 1,015 Times in 988 Posts
    This isn’t primarily about personal browser preference, it’s about how browsers render the HTML they get. And it is true and undeniable that all current major browsers are better than IE when it comes to rendering HTML and supporting the web standards. This has nothing to do with personal preference.

    Of course it’s important to code for IE since this is still the most widely used browser. The only thing everybody was trying to tell you and one should keep in mind is that during development you shouldn’t use IE as primary measure since it will show things differently than other browsers and if you base your coding on how IE is interpreting it then most likely you will have problems in all other browsers because you will use wrong code to make it look right in IE but others display the wrong code as it is (i. e.: wrong).

    That’s because we professionals will all tell you: Use a standards compliant browser (I’ve mentioned them often enough above) as primary reference and if IE displays something wrong while you develop your pages then there are ways to fix it so it looks right in all major browsers eventually.

    Once again I can just say: If you show us your output HTML that the PHP is generating then it’s is a matter of minutes for us to help you display it right in Firefox/Camino/Netscape, Opera, Safari, Internet Explorer 6 and 7, Google Chome, and iCab altogether (at least).

    But if you think you got it sorted and don’t need our expertise anymore then that’s OK. You can come back anytime if you have further questions.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •