Results 1 to 12 of 12

Thread: CSS problems

  1. #1
    Senior Member Kezzer's Avatar
    Join Date
    Sep 2003
    Posts
    4,863
    Thanks
    12
    Thanked
    5 times in 5 posts

    CSS problems

    Why is it you can't have 2 divs wrapped around two bits of text and keep it on the same line?

    For example:

    <div id="footer">
    Copyright blah blah
    <div align="right">
    Hit counter here
    </div>
    </div>

    It throws the second div on a line lower. I still don't understand why it's doing it. I have to keep the second div wrapped in the first one because that's what confines it to the rules of CSS otherwise it would align to the very right hand side of the document. This is the only problem i've got left with my new site design

  2. #2
    Pixel Abuser Spunkey's Avatar
    Join Date
    Nov 2003
    Location
    Milton Keynes
    Posts
    1,523
    Thanks
    0
    Thanked
    0 times in 0 posts
    AFAIK div tags cause a line break, bit like table tags.

    try a <span> instead of div, as that doesnt break.

    HTH
    Last edited by Spunkey; 17-03-2004 at 01:55 PM.

  3. #3
    Senior Member Kezzer's Avatar
    Join Date
    Sep 2003
    Posts
    4,863
    Thanks
    12
    Thanked
    5 times in 5 posts
    Never used the <span> tag before. Is it XHTML 1.1 compliant?

  4. #4
    Pixel Abuser Spunkey's Avatar
    Join Date
    Nov 2003
    Location
    Milton Keynes
    Posts
    1,523
    Thanks
    0
    Thanked
    0 times in 0 posts
    dunno bout XHTML as ive never used it, but it is HTML Transitional 4.01 if thats any help.

  5. #5
    HEXUS.net Webmaster
    Join Date
    Jul 2003
    Location
    UK
    Posts
    3,108
    Thanks
    1
    Thanked
    0 times in 0 posts
    <span> is for an inline item and should be used within a container block e.g. a div. Every time you start a div you start a new container with different CSS rules (except those that are inherited) and hence will always get a line break

    <span> is effectively a replacement for things such as <b> <font> <i> <u> and so on and is the accepted XHTML method for changing the style of an inline element

  6. #6
    Senior Member Kezzer's Avatar
    Join Date
    Sep 2003
    Posts
    4,863
    Thanks
    12
    Thanked
    5 times in 5 posts
    argh i still can't get it to align right. I do <span style="text-align:right;">text</span> but that part is embedded in another div yet the span tag is still not used unless i'm doing it wrong

  7. #7
    HEXUS.net Webmaster
    Join Date
    Jul 2003
    Location
    UK
    Posts
    3,108
    Thanks
    1
    Thanked
    0 times in 0 posts
    Use a float and don't put styles inline, use a CSS file

    so have
    <div id="footer">
    Copyright blah blah
    <div class="footerRight">
    Hit counter here
    </div>
    </div>

    with the style

    .footerRight {
    float: right;}

  8. #8
    Senior Member Kezzer's Avatar
    Join Date
    Sep 2003
    Posts
    4,863
    Thanks
    12
    Thanked
    5 times in 5 posts
    The only way to do it in the end was like this:

    <div id="footer">
    <div style="float:left; display:inline;">Copyright &copy; KeZZeR.co.uk 2004 All rights reserved</div>
    <div style="float:right; display:inline;"><?php include('includes/counter.php'); ?></div>
    </div>

    I finally figured it out

  9. #9
    HEXUS.net Webmaster
    Join Date
    Jul 2003
    Location
    UK
    Posts
    3,108
    Thanks
    1
    Thanked
    0 times in 0 posts
    Don't put styles inline, it defeats the point of CSS. Give each of those divs a style name and put the styles into a CSS file. That way if you change the style of the footer then it will automatically update every page

  10. #10
    Senior Member Kezzer's Avatar
    Join Date
    Sep 2003
    Posts
    4,863
    Thanks
    12
    Thanked
    5 times in 5 posts
    Good point. Yeh i'll do that later on.

    http://www.kezzer.co.uk/

    Check it out though. The new simpler design. Loading times cut right down and it's using XHTML and CSS as opposed to tables. The simplest design ever but i find it looks nicer than before. Still need to do the database

  11. #11
    HEXUS.net Webmaster
    Join Date
    Jul 2003
    Location
    UK
    Posts
    3,108
    Thanks
    1
    Thanked
    0 times in 0 posts
    You're not accounting for the way IE treats the box model. If you look at the site in Mozilla your form inputs are right next to each other. Best to build your site using Firefox as your browser and then make changes to make it work in IE. THat way you build compliant CSS and add the hacks later rather than building incorrect CSS and then reversing it back to make it look the same in Mozilla

    One piece of advice to anyone who's aiming for compliance, don't build using IE as your browser, you'll only end up suffering later on

  12. #12
    Senior Member Kezzer's Avatar
    Join Date
    Sep 2003
    Posts
    4,863
    Thanks
    12
    Thanked
    5 times in 5 posts
    I use firefox and then go back to it in IE like you said. I only just created that form box last nite and haven't had time to make it work properly for IE yet and i'm not home to sort the problem out.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. audio and video problems, and windows app in linux
    By fedoracore in forum Software
    Replies: 0
    Last Post: 28-01-2004, 05:22 PM
  2. divs and CSS
    By Kezzer in forum Software
    Replies: 11
    Last Post: 18-11-2003, 12:51 PM
  3. CSS aid
    By Iain in forum Software
    Replies: 1
    Last Post: 14-10-2003, 11:40 PM
  4. CSS + Other Language Questions
    By Jonny M in forum Software
    Replies: 7
    Last Post: 11-10-2003, 11:17 PM
  5. CSS Help
    By Basher in forum Software
    Replies: 19
    Last Post: 10-09-2003, 08:13 PM

Posting Permissions

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