Furkan Aydın
Furkan Aydın

Reputation: 119

CSS percent layout going too far

I have css problem. I don't know why it's happening. This is picture about website css.

This is what is going on.

Upvotes: 0

Views: 39

Answers (2)

Staveven
Staveven

Reputation: 120

It looks like you might be missing some tags or you need to define a width for a container of ALL the elements.

Another option is to hide the overflow.

If the CSS says for the width to be 100%, and it's going past the area, it means you haven't properly set up your divs.

Without you providing any code it will be hard to help you.

Upvotes: 0

stack overflow user
stack overflow user

Reputation: 94

Width of You content area is 100% and that width is inherited from the body. I think you should use something like this

    .container { 
      border : 2px solid #000; 
      overflow:hidden;
    }

    #one {
      background-color: gray;
      float:left; 
      padding:15px;
      width:50px;
      border-right:2px solid #000;
      height:200px;
    }
    #two { 
      background-color: gray;
      float:left;
      padding:15px;
      width:300px;
      height:200px;
      border-right:2px solid #000;
    }
    
    #three { 
      background-color: white;
      width:300px;
      height:200px;
      border-right:2px solid #000;
    }
  <div class="container">
    <div id="one">one</div>
    <div id="two">two</div>
    <div id="three">three</div>
  </div>

Upvotes: 1

Related Questions