473,396 Members | 2,010 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Header Background

Hello,

I am trying to create a header with a background color and a padding
of the text.
I know that if I apply the background color to the header it will
expand 100%.
So I did the following:

<h1><span>Header</span></h1>

h1 {}

h1 span {
background-color: #252525;
color: #D2D2D2;
font: normal 1.2em/1.8 Verdana, Geneva, sans-serif;
letter-spacing: 0.1em;
padding: 0.8em;
}

But now I am not able to apply the top and bottom border.

How should I created this header?

Thanks,
Miguel
Jun 27 '08 #1
11 2746
"shapper" <md*****@gmail.comwrote in message
news:7e**********************************@a1g2000h sb.googlegroups.com...
Hello,

I am trying to create a header with a background color and a padding
of the text.
I know that if I apply the background color to the header it will
expand 100%.
So I did the following:

<h1><span>Header</span></h1>

h1 {}

h1 span {
background-color: #252525;
color: #D2D2D2;
font: normal 1.2em/1.8 Verdana, Geneva, sans-serif;
letter-spacing: 0.1em;
padding: 0.8em;
}

But now I am not able to apply the top and bottom border.

How should I created this header?
What do you mean?

I was able to apply a top and bottom border just fine, using exactly your
code::

http://nrkn.com/headerBackground/

Jun 27 '08 #2
On May 20, 1:40 am, "Nik Coughlin" <nrkn....@gmail.comwrote:
"shapper" <mdmo...@gmail.comwrote in message

news:7e**********************************@a1g2000h sb.googlegroups.com...
Hello,
I am trying to create a header with a background color and a padding
of the text.
I know that if I apply the background color to the header it will
expand 100%.
So I did the following:
<h1><span>Header</span></h1>
h1 {}
h1 span {
background-color: #252525;
color: #D2D2D2;
font: normal 1.2em/1.8 Verdana, Geneva, sans-serif;
letter-spacing: 0.1em;
padding: 0.8em;
}
But now I am not able to apply the top and bottom border.
How should I created this header?

What do you mean?

I was able to apply a top and bottom border just fine, using exactly your
code::

http://nrkn.com/headerBackground/
Sorry, not border. Top and Bottom padding.
Jun 27 '08 #3
In article
<7e**********************************@a1g2000hsb.g ooglegroups.com>,
shapper <md*****@gmail.comwrote:
I know that if I apply the background color to the header it will
expand 100%.
How do you know things that look false?

--
dorayme
Jun 27 '08 #4
"shapper" <md*****@gmail.comwrote in message
news:3f**********************************@34g2000h sf.googlegroups.com...
On May 20, 1:40 am, "Nik Coughlin" <nrkn....@gmail.comwrote:
>"shapper" <mdmo...@gmail.comwrote in message

news:7e**********************************@a1g2000 hsb.googlegroups.com...
Hello,
I am trying to create a header with a background color and a padding
of the text.
I know that if I apply the background color to the header it will
expand 100%.
So I did the following:
<h1><span>Header</span></h1>
h1 {}
h1 span {
background-color: #252525;
color: #D2D2D2;
font: normal 1.2em/1.8 Verdana, Geneva, sans-serif;
letter-spacing: 0.1em;
padding: 0.8em;
}
But now I am not able to apply the top and bottom border.
How should I created this header?

What do you mean?

I was able to apply a top and bottom border just fine, using exactly your
code::

http://nrkn.com/headerBackground/

Sorry, not border. Top and Bottom padding.
Top and bottom padding work fine. See the following example, where I've
removed top and bottom padding from the second h1:

http://nrkn.com/headerBackground/

Jun 27 '08 #5
On 2008-05-20, shapper <md*****@gmail.comwrote:
Hello,

I am trying to create a header with a background color and a padding
of the text.
I know that if I apply the background color to the header it will
expand 100%.
It will take all of the available width, since auto width is "greedy"
for normal-flow block boxes.
So I did the following:

<h1><span>Header</span></h1>

h1 {}

h1 span {
background-color: #252525;
color: #D2D2D2;
font: normal 1.2em/1.8 Verdana, Geneva, sans-serif;
letter-spacing: 0.1em;
padding: 0.8em;
}

But now I am not able to apply the top and bottom border.

How should I created this header?
Are you talking about the way the span's padding and border overflow the
<h1>'s box?

I would advise don't decorate inline boxes in this way. Background
colours are OK, but as I tried to explained previously, top and bottom
borders and padding on inline boxes are ephemera without substance that
are visible but have no ability to move anything else on the page out of
their way.

(Inline box top and bottom margins are even worse: they are invisible
ephemera without substance.)

Better decorate the <h1itself but give it shrink-to-fit width, which
you can do by floating it left or making it display: table (the latter
won't work in IE).

Or you could stick to inline box decoration but give the <h1enough
padding to make room for it, but this involves guesswork.
Jun 27 '08 #6
In article
<7e**********************************@a1g2000hsb.g ooglegroups.com>,
shapper <md*****@gmail.comwrote:
Hello,

I am trying to create a header with a background color and a padding
of the text.
I know that if I apply the background color to the header it will
expand 100%.
So I did the following:

<h1><span>Header</span></h1>
Not immediately answering your question, but why bother with
the span at all? The css can be applied directly to h1...
Jun 27 '08 #7
On May 20, 8:16 am, Ben C <spams...@spam.eggswrote:
On 2008-05-20, shapper <mdmo...@gmail.comwrote:
Hello,
I am trying to create a header with a background color and a padding
of the text.
I know that if I apply the background color to the header it will
expand 100%.

It will take all of the available width, since auto width is "greedy"
for normal-flow block boxes.
So I did the following:
<h1><span>Header</span></h1>
h1 {}
h1 span {
background-color: #252525;
color: #D2D2D2;
font: normal 1.2em/1.8 Verdana, Geneva, sans-serif;
letter-spacing: 0.1em;
padding: 0.8em;
}
But now I am not able to apply the top and bottom border.
How should I created this header?

Are you talking about the way the span's padding and border overflow the
<h1>'s box?

I would advise don't decorate inline boxes in this way. Background
colours are OK, but as I tried to explained previously, top and bottom
borders and padding on inline boxes are ephemera without substance that
are visible but have no ability to move anything else on the page out of
their way.

(Inline box top and bottom margins are even worse: they are invisible
ephemera without substance.)

Better decorate the <h1itself but give it shrink-to-fit width, which
you can do by floating it left or making it display: table (the latter
won't work in IE).

Or you could stick to inline box decoration but give the <h1enough
padding to make room for it, but this involves guesswork.
Hi,

Sorry, for the delay of my answer. I had problems with my ISP for the
past hours.

Ben, if I use float I will need to clear the float after it the header
tag?
I am using the guessing method in this method using pixels as measure
and not em.
It work with the list items I was working on ...

About display: table I have done it a few hours ago and it worked ...
but I was told this is not a good option sometime ago.
I am not sure if I can do this ...

I will upload some of my experiences later today ...

Thank You,
Miguel
Jun 27 '08 #8
On 2008-05-20, shapper <md*****@gmail.comwrote:
On May 20, 8:16 am, Ben C <spams...@spam.eggswrote:
>On 2008-05-20, shapper <mdmo...@gmail.comwrote:
Hello,
I am trying to create a header with a background color and a padding
of the text.
I know that if I apply the background color to the header it will
expand 100%.

It will take all of the available width, since auto width is "greedy"
for normal-flow block boxes.
[...]
>>
Are you talking about the way the span's padding and border overflow the
<h1>'s box?

I would advise don't decorate inline boxes in this way. Background
colours are OK, but as I tried to explained previously, top and bottom
borders and padding on inline boxes are ephemera without substance that
are visible but have no ability to move anything else on the page out of
their way.

(Inline box top and bottom margins are even worse: they are invisible
ephemera without substance.)

Better decorate the <h1itself but give it shrink-to-fit width, which
you can do by floating it left or making it display: table (the latter
won't work in IE).

Or you could stick to inline box decoration but give the <h1enough
padding to make room for it, but this involves guesswork.

Hi,

Sorry, for the delay of my answer. I had problems with my ISP for the
past hours.

Ben, if I use float I will need to clear the float after it the header
tag?
Yes.
I am using the guessing method in this method using pixels as measure
and not em. It work with the list items I was working on ...
At least guess with em-- then it should be fairly close. The inline box
usually runs vertically from the font's max ascent to its max descent,
which is about 1em.

But it all depends on what the particular font designer thought "1em"
and "max ascent" and "max descent" meant, and whether/how the browser
creators also fudged things...
About display: table I have done it a few hours ago and it worked ...
but I was told this is not a good option sometime ago.
I am not sure if I can do this ...
Display: table is a good 'un, except it doesn't work in IE. So it just
depends on whether you need to support IE.
Jun 27 '08 #9
On May 20, 2:42 pm, Ben C <spams...@spam.eggswrote:
On 2008-05-20, shapper <mdmo...@gmail.comwrote:
On May 20, 8:16 am, Ben C <spams...@spam.eggswrote:
On 2008-05-20, shapper <mdmo...@gmail.comwrote:
Hello,
I am trying to create a header with a background color and a padding
of the text.
I know that if I apply the background color to the header it will
expand 100%.
It will take all of the available width, since auto width is "greedy"
for normal-flow block boxes.
[...]
Are you talking about the way the span's padding and border overflow the
<h1>'s box?
I would advise don't decorate inline boxes in this way. Background
colours are OK, but as I tried to explained previously, top and bottom
borders and padding on inline boxes are ephemera without substance that
are visible but have no ability to move anything else on the page out of
their way.
(Inline box top and bottom margins are even worse: they are invisible
ephemera without substance.)
Better decorate the <h1itself but give it shrink-to-fit width, which
you can do by floating it left or making it display: table (the latter
won't work in IE).
Or you could stick to inline box decoration but give the <h1enough
padding to make room for it, but this involves guesswork.
Hi,
Sorry, for the delay of my answer. I had problems with my ISP for the
past hours.
Ben, if I use float I will need to clear the float after it the header
tag?

Yes.
I am using the guessing method in this method using pixels as measure
and not em. It work with the list items I was working on ...

At least guess with em-- then it should be fairly close. The inline box
usually runs vertically from the font's max ascent to its max descent,
which is about 1em.

But it all depends on what the particular font designer thought "1em"
and "max ascent" and "max descent" meant, and whether/how the browser
creators also fudged things...
About display: table I have done it a few hours ago and it worked ...
but I was told this is not a good option sometime ago.
I am not sure if I can do this ...

Display: table is a good 'un, except it doesn't work in IE. So it just
depends on whether you need to support IE.
Hi,

using the display: table is not a solution. I would like IE to not
exist ... but it does. lol

About the float left is a good solution because I don't need guessing
but I don't like very much to add empty tags only for clear ...
.... but if it is needed then ...

The guessing is ok but I am afraid that there will be a browser or
configuration when this will break the design.
I am trying to put the header just next to the tag after ... no space
and no overlapping ... just on the limit.

I was using px for margin guessing because when I was solving the list
problem that space increased with the text resize ... now in the
header it does not ... I am confused ... In my opinion it should
increase.

Here are my latest experiments:
http://www.27lamps.com/public/Header1.htm
http://www.27lamps.com/public/Header2.htm
http://www.27lamps.com/public/Header3.htm

On Header2 example I am not sure why am I getting a bigger size ...
maybe the spam is getting 1.2em relative to the h1? Not sure ... how
to solve this?

Thanks,
Miguel
Jun 27 '08 #10
On May 20, 2:42 pm, Ben C <spams...@spam.eggswrote:
On 2008-05-20, shapper <mdmo...@gmail.comwrote:
On May 20, 8:16 am, Ben C <spams...@spam.eggswrote:
On 2008-05-20, shapper <mdmo...@gmail.comwrote:
Hello,
I am trying to create a header with a background color and a padding
of the text.
I know that if I apply the background color to the header it will
expand 100%.
It will take all of the available width, since auto width is "greedy"
for normal-flow block boxes.
[...]
Are you talking about the way the span's padding and border overflow the
<h1>'s box?
I would advise don't decorate inline boxes in this way. Background
colours are OK, but as I tried to explained previously, top and bottom
borders and padding on inline boxes are ephemera without substance that
are visible but have no ability to move anything else on the page out of
their way.
(Inline box top and bottom margins are even worse: they are invisible
ephemera without substance.)
Better decorate the <h1itself but give it shrink-to-fit width, which
you can do by floating it left or making it display: table (the latter
won't work in IE).
Or you could stick to inline box decoration but give the <h1enough
padding to make room for it, but this involves guesswork.
Hi,
Sorry, for the delay of my answer. I had problems with my ISP for the
past hours.
Ben, if I use float I will need to clear the float after it the header
tag?

Yes.
I am using the guessing method in this method using pixels as measure
and not em. It work with the list items I was working on ...

At least guess with em-- then it should be fairly close. The inline box
usually runs vertically from the font's max ascent to its max descent,
which is about 1em.

But it all depends on what the particular font designer thought "1em"
and "max ascent" and "max descent" meant, and whether/how the browser
creators also fudged things...
About display: table I have done it a few hours ago and it worked ...
but I was told this is not a good option sometime ago.
I am not sure if I can do this ...

Display: table is a good 'un, except it doesn't work in IE. So it just
depends on whether you need to support IE.
Hi,

using the display: table is not a solution. I would like IE to not
exist ... but it does. lol

About the float left is a good solution because I don't need guessing
but I don't like very much to add empty tags only for clear ...
.... but if it is needed then ...

The guessing is ok but I am afraid that there will be a browser or
configuration when this will break the design.
I am trying to put the header just next to the tag after ... no space
and no overlapping ... just on the limit.

I was using px for margin guessing because when I was solving the list
problem that space increased with the text resize ... now in the
header it does not ... I am confused ... In my opinion it should
increase.

Here are my latest experiments:
http://www.27lamps.com/public/Header1.htm
http://www.27lamps.com/public/Header2.htm
http://www.27lamps.com/public/Header3.htm

On Header2 example I am not sure why am I getting a bigger size ...
maybe the spam is getting 1.2em relative to the h1? Not sure ... how
to solve this?

Thanks,
Miguel
Jun 27 '08 #11
On 2008-05-21, shapper <md*****@gmail.comwrote:
[...]
The guessing is ok but I am afraid that there will be a browser or
configuration when this will break the design.
I am trying to put the header just next to the tag after ... no space
and no overlapping ... just on the limit.
That's why guessing is no good. It's all right if you just want a small
gap-- you can make the gap a bit too big. But if you want things to fit
together exactly, use the float.
I was using px for margin guessing because when I was solving the list
problem that space increased with the text resize ... now in the
header it does not ... I am confused ... In my opinion it should
increase.

Here are my latest experiments:
http://www.27lamps.com/public/Header1.htm
http://www.27lamps.com/public/Header2.htm
http://www.27lamps.com/public/Header3.htm

On Header2 example I am not sure why am I getting a bigger size ...
maybe the spam is getting 1.2em relative to the h1?
Yes, that's what's happening

H1 gets a big font-size from the default stylesheet (probably about
2em). In Header1.htm you're replacing that with 1.2em, so making it
smaller.

In Header2.htm, the H1's font size is still 2em (since you didn't set
it), and you're making the span 1.2 times as big again.
Not sure ... how to solve this?
Just put the font-size: 1.2em on the H1 instead of on the span in all
cases.
Jun 27 '08 #12

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Dan V. | last post by:
Still struggling with css. Anyone know how to put a tope background colour (matches the right part of the banner image) that stretches to the max. size of the window like the main div? My header...
1
by: Dan V. | last post by:
Does anyone know why the header looks correct in IE 6.0 and not Firefox 1.07? I am trying to have a header that looks good when you expand it wider and smaller. In other words when you shrink...
2
by: ~john | last post by:
I'm trying to get my header to have 2 images, one for the top left and one for the top right. Here's a link to my page... http://levelwave.com/dev/div/index.html and will eventually be...
1
by: KoosHopeloos | last post by:
L.S., I'm trying to make a layout which is completely fixed in width and height if needed by using three divs rows (header, content, footer) which have each 3 div again to be able to play around...
3
by: guitar | last post by:
Hi, I have created a table, which has a stable header and a scroller for data. One of my data field has a combo box... Everything works fine but the combo moves over the header when scrolled... ...
5
by: Mel | last post by:
I created a header that adjusts with the size of the browser windows. How do I place labels in the header section so they also maintain their position when the window is resized? One of the labels...
1
by: swc76801 | last post by:
I desperately need help. My understanding of CSS is non-existent. I have a store http://astore.amazon.com/texasheat-20 with Amazon.com. According to the information from Amazon.com "Write your own...
2
by: darkzone | last post by:
Looked almost ok in my editor but not so good in fire fox. I was going for a layout that was elastic some what. A header with one image repeating 100%, an there image slightly to the left also in...
3
by: Noorain | last post by:
I designed a site. i want to header,footer,left & right column fixed but body information only scrolling. this site screen to be 800/600 px. i designed this way but when i used position fixed all...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.