HighDots Forums  

width:100% + padding

Cascading Style Sheets Layout/presentation on the WWW (comp.infosystems.www.authoring.stylesheets)


Discuss width:100% + padding in the Cascading Style Sheets forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Chris Leipold
 
Posts: n/a

Default width:100% + padding - 11-12-2004 , 05:19 AM






Hi,

I have a problem with an element of 100% width and a left paddig. The
effect I try to achieve is easy, take a look at:
http://swing-tanzen-verboten.de/test.html

My Problem is, the width of the element h1 is 100%+20px and causes
therefore an horizontal scrollbar. Looks not nice.

Any ideas how to get the element to a width of 100% with a padding?

Thanks

Chris

Reply With Quote
  #2  
Old   
Mark Tranchant
 
Posts: n/a

Default Re: width:100% + padding - 11-12-2004 , 05:30 AM






Chris Leipold wrote:
Quote:
Hi,

I have a problem with an element of 100% width and a left paddig. The
effect I try to achieve is easy, take a look at:
http://swing-tanzen-verboten.de/test.html

My Problem is, the width of the element h1 is 100%+20px and causes
therefore an horizontal scrollbar. Looks not nice.

Any ideas how to get the element to a width of 100% with a padding?
You need to nest it. Create a container of 100% width, then put the
element inside it with 20px left margin.

--
Mark.
http://tranchant.plus.com/


Reply With Quote
  #3  
Old   
2metre
 
Posts: n/a

Default Re: width:100% + padding - 11-12-2004 , 11:35 AM



Chris Leipold wrote:
Quote:
Hi,

I have a problem with an element of 100% width and a left paddig. The
effect I try to achieve is easy, take a look at:
http://swing-tanzen-verboten.de/test.html

My Problem is, the width of the element h1 is 100%+20px and causes
therefore an horizontal scrollbar. Looks not nice.

Any ideas how to get the element to a width of 100% with a padding?

Thanks

Chris
It's not the padding that is giving the problem.
Add left:0; to the style.


Reply With Quote
  #4  
Old   
Steve Pugh
 
Posts: n/a

Default Re: width:100% + padding - 11-12-2004 , 11:57 AM



On Fri, 12 Nov 2004 16:35:02 +0000 (UTC), 2metre
<2metre (AT) xxxhersham (DOT) net> wrote:
Quote:
Chris Leipold wrote:

I have a problem with an element of 100% width and a left paddig. The
effect I try to achieve is easy, take a look at:
http://swing-tanzen-verboten.de/test.html

My Problem is, the width of the element h1 is 100%+20px and causes
therefore an horizontal scrollbar. Looks not nice.

Any ideas how to get the element to a width of 100% with a padding?


It's not the padding that is giving the problem.
Yes it is.
100% + 20px is greater than 100% therefore scrolling is produced.

Quote:
Add left:0; to the style.
That moves the blue all the way to the left, but (except in IE5 with
its broken box model) still produces horizontal scroling.

Steve



Reply With Quote
  #5  
Old   
henman
 
Posts: n/a

Default Re: width:100% + padding - 11-15-2004 , 03:47 AM



Steve Pugh <steve (AT) pugh (DOT) net> wrote

Quote:
On Fri, 12 Nov 2004 16:35:02 +0000 (UTC), 2metre
2metre (AT) xxxhersham (DOT) net> wrote:
Chris Leipold wrote:

I have a problem with an element of 100% width and a left paddig. The
effect I try to achieve is easy, take a look at:
http://swing-tanzen-verboten.de/test.html

My Problem is, the width of the element h1 is 100%+20px and causes
therefore an horizontal scrollbar. Looks not nice.

Any ideas how to get the element to a width of 100% with a padding?


It's not the padding that is giving the problem.

Yes it is.
100% + 20px is greater than 100% therefore scrolling is produced.

Add left:0; to the style.

That moves the blue all the way to the left, but (except in IE5 with
its broken box model) still produces horizontal scroling.

Steve
create a table with 100% as width and add the h1 inside it

e.g:
<table style="background-color: blue;" width="100%">
<tr><td>
<h1 style="margin: 0px; padding-left: 20px; color: white;">Foobar</h1>
</td></tr></table>

henman


Reply With Quote
  #6  
Old   
Steve Pugh
 
Posts: n/a

Default Re: width:100% + padding - 11-15-2004 , 05:57 AM



On 15 Nov 2004 00:47:22 -0800, saisan (AT) gmail (DOT) com (henman) wrote:

Quote:
create a table with 100% as width and add the h1 inside it
Why? Is it tabular data?

Steve



Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.