472,962 Members | 2,478 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

Shrink wrap header background & clearing floats

I want to set a background colour on one level of headings, but have
their width span only the text & a small amount of padding.

I was styling display to inline to achieve this.

Then I realised I need to have clear: left, to keep the headings against
the lefthand side, should they come near floats.

I can't see how to do this without having to introduce unpleasant extra
markup.

ATM I've resorted to <h3><span>Heading text</span></h3>

With clear on h3 & the background set on h3 span :-/

http://digitalrat.co.uk/test3/index.html

--
Michael
m r o z a t u k g a t e w a y d o t n e t
Jul 21 '05 #1
6 3605
Michael Rozdoba <mr**@nowhere.invalid> wrote:
I want to set a background colour on one level of headings, but
have their width span only the text & a small amount of padding.

I was styling display to inline to achieve this.

Then I realised I need to have clear: left, to keep the headings
against the lefthand side, should they come near floats.
Moreover, you can't effectively set top and bottom margins. You could
set margins for the preceding and following element, but it gets
awkward (you would probably need to class those elements, etc.).
ATM I've resorted to <h3><span>Heading text</span></h3>


That's the usual workaround.

--
Yucca, http://www.cs.tut.fi/~jkorpela/
Jul 21 '05 #2
in comp.infosystems.www.authoring.stylesheets, Michael Rozdoba wrote:
I want to set a background colour on one level of headings, but have
their width span only the text & a small amount of padding.
display:table;
I was styling display to inline to achieve this.
That is
Then I realised I need to have clear: left, to keep the headings against
the lefthand side, should they come near floats.

I can't see how to do this without having to introduce unpleasant extra
markup.


Well, big question is if it needs to work on IE

--
Lauri Raittila <http://www.iki.fi/lr> <http://www.iki.fi/zwak/fonts>
Jul 21 '05 #3
Jukka K. Korpela wrote:
Michael Rozdoba <mr**@nowhere.invalid> wrote:

ATM I've resorted to <h3><span>Heading text</span></h3>


That's the usual workaround.


Okay, thanks. At least I've not overlooked something obvious.

--
Michael
m r o z a t u k g a t e w a y d o t n e t
Jul 21 '05 #4
Lauri Raittila wrote:
in comp.infosystems.www.authoring.stylesheets, Michael Rozdoba wrote:
I want to set a background colour on one level of headings, but have
their width span only the text & a small amount of padding.

display:table;


I later found that in connection with captioning & thought it might be
an option, but...
I can't see how to do this without having to introduce unpleasant extra
markup.


Well, big question is if it needs to work on IE


Alas, yes :/

--
Michael
m r o z a t u k g a t e w a y d o t n e t
Jul 21 '05 #5
*Michael Rozdoba* <mr**@nowhere.invalid>:

I want to set a background colour on one level of headings, but have
their width span only the text & a small amount of padding.


h3 {float: left; clear: both;}
h3+* {clear: left}

maybe? (Of course you'd need to use something different than "h3+*" to
please IE and MacIE doesn't do shrink-wrap on floats.)

--
We are the e-continent!
Jul 21 '05 #6
Christoph Paeper wrote:
*Michael Rozdoba* <mr**@nowhere.invalid>:

I want to set a background colour on one level of headings, but have
their width span only the text & a small amount of padding.

h3 {float: left; clear: both;}
h3+* {clear: left}

maybe? (Of course you'd need to use something different than "h3+*" to
please IE and MacIE doesn't do shrink-wrap on floats.)


Thanks for the idea, though the problems with IE would probably put me
off. I guess I'll stick with the extra span markup for now.

--
Michael
m r o z a t u k g a t e w a y d o t n e t
Jul 21 '05 #7

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

Similar topics

5
by: BashiraInTrouble | last post by:
Hi Friends, I have tried almost everything but I cant seem to shrink the transaction log. Executing DBCC SQLPERF(LOGSPACE) gives me this info: Database Log Size (MB) Log Space Used (%) ...
18
by: Niels | last post by:
Hi group, I have some problems with clearing floated divs. My usual method works fine in Konqueror, but not in Firefox. Here's an example: <html><body> <div id='left' style='float:left;...
4
by: LB | last post by:
Apologies if this sounds like a very newbie question. I'm putting together a 3 column layout at the moment, the left 2 columns are effectively menus and the third one is the 'content'. Now,...
3
by: Mr. T. | last post by:
Hello, i have a page where i have a white box centered on the screen. Now in IE everything shows fine, but in FireFox and Netscape the background of the box isn't white. But all the positioning...
1
by: Sam | last post by:
I want to create header whereby I could reuse whenever new aspx. However, it is display nothing and please find my coding: index.aspx ========== <%@ Page Language="VB" %> <%@ Register...
7
by: Andrew | last post by:
I've been struggling to achieve the following layout for some time now and I'm not getting anywhere. I've tried several approaches including floats & absolute positioning and none seem to work,...
0
by: ghadley_00 | last post by:
Hi, I have a report that has fields that grow/shrink. These reports each have an image as a background. For records that cause the boxes to shrink / grow I get a second page that only has the...
13
by: yb | last post by:
Hi, Is there a CSS method to clear a float such that it aligns with the left content edge. For example: X X X X X X X X
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: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: Aliciasmith | last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
0
tracyyun
by: tracyyun | last post by:
Hello everyone, I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
2
by: giovanniandrean | last post by:
The energy model is structured as follows and uses excel sheets to give input data: 1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
4
NeoPa
by: NeoPa | last post by:
Hello everyone. I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report). I know it can be done by selecting :...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM) Please note that the UK and Europe revert to winter time on...
3
by: nia12 | last post by:
Hi there, I am very new to Access so apologies if any of this is obvious/not clear. I am creating a data collection tool for health care employees to complete. It consists of a number of...
0
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...

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.