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 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Nov 2012
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Unhappy Two div within a div : fixing text positions

    Hello, I am a noob when it comes to HTML and CSS, and I need some help. What I have been trying to do is that I created a div with a width of whole screen and height of 80px. Then I proceeded to create two div within that div - those two div will be positioned in the same line, not up and down. Now I can do that, but the problem are the words. When I resize the browsers to reduce width, the texts all begin to shrink, meaning they become positioned one after another. I think these two attached images will explain my problem.




    Now what I want to do is that I want to place "Blog Outta Hell" on the left side of the screen and the "Beware" staff on the right side of the screen, and I don't want them to be fixed or absolute. I want those two div within the main div and not exceeding the boundary. I also want those words not to be placed one after another when I resize my browser window, meaning I want them to be constant. What can I do to achieve that? I can show you guys what have I done so far with CSS, please check my code out and help me find this solution.

    Code:
    div#header   //this is the main div
    {
      width:100%;
      height:80px;
      display:block;
      background-color:#3B5998;
      position:relative;
    }
    div#header_content   //this is the left div
    {
      font-family:"lucida grande",tahoma,verdana,arial,sans-serif;
      float:left;
      font-size:41px;
      font-weight:bolder;
      color:white;
      outline:none;
      padding-left:15px;
      padding-top:15px
    }
    div#header_content2{  //this is the right div
      font-size:21px;
      text-align:right;
      font-family:"tahoma",Helvetica,serif;
      color:#99F5FF;
      outline:none;
      padding-right:20px;
      padding-top:25px;
      text-shadow:2px 2px 2px #31CDDE;
    }

    Please help me find this solution, this has been bugging me for days. Thanks in advance!

  • #2
    Master Coder Excavator's Avatar
    Join Date
    Dec 2006
    Location
    Alaska
    Posts
    9,668
    Thanks
    22
    Thanked 1,827 Times in 1,811 Posts
    Hello faheem00,
    Maybe putting a min-width on your #header will do what you want.
    Validate often DURING development - Use it like a splelchecker | Debug during Development |Write it for FireFox, ignore IE
    Use the right DocType | Validate your markup | Validate your CSS | Why validating is good | Why tables are bad

  • #3
    New to the CF scene
    Join Date
    Nov 2012
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Hey Excavator, thanks for the tip now the two div are not placed upon one another regardless the size of the browser window.

    But another problem has surfaced now. I want the "beware" stuff to not move when I resize the window, I want it to stay at the right side of the screen, but it still moves to left. I've tried inline, min-width, span, margin, absolute and fixed position, but the text still moves with the browser. Can you or anyone help me to keep the text fixed regardless the size of the browser window? Thanks.


  •  

    Tags for this Thread

    Posting Permissions

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