471,598 Members | 1,356 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

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

H1

Hello,

I want a H1 tag inside a div.
I want the H1 tag to have a image background and to expand full width
in relation to its container div.
Is this possible using CSS, or should I place the H1 tag inside a div
where i apply the 100% width and the background image?

Thanks,
Miguel

Oct 17 '07 #1
3 2206
shapper wrote:
>
I want the H1 tag to have a image background and to expand full width
You cannot resize a background image. There is a proposed property for
this in CSS3, but it is not yet supported by any browser.

--
Berg
Oct 17 '07 #2
On 10/16/07 05:21 pm, shapper wrote:
>
I want a H1 tag inside a div.
Why?
I want the H1 tag to have a image background and to expand full width
in relation to its container div.
The h1 tag? Or the image?
If the h1 tag, there is nothing to do. It's the default property.
If the image, "stop wanting that."
Is this possible using CSS, or should I place the H1 tag inside a div
where i apply the 100% width and the background image?
Yes.
You could do that, too.
Or you could do something else. Since you have provided no context for
your ambiguous questions, just about anything would work.

--
jmm (hyphen) list (at) sohnen-moe (dot) com
(Remove .AXSPAMGN for email)
Oct 17 '07 #3
In article
<do**********************************@news-vip.optusnet.com.au>,
dorayme <do************@optusnet.com.auwrote:
In article
<11**********************@v23g2000prn.googlegroups .com>,
shapper <md*****@gmail.comwrote:
Hello,

I want a H1 tag inside a div.
I want the H1 tag to have a image background and to expand full width
in relation to its container div.
Is this possible using CSS, or should I place the H1 tag inside a div
where i apply the 100% width and the background image?

You might get what you want with something like:
<body>
<div>
<h1 style="width:100%;text-align: center; background:
url(pics/home.gif) #fff;">A Heading</h1>
</div>
>
(Just btw, you don't need the div in this if all it has is an
<h1></h1>)
Nor do you need to put in the 100% - as Jim points out. Not sure
what I was thinking. As long as nothing is over-riding the
default elsewhere in the css. And the image needs to be big
enough to fit in all likely contexts. Perhaps you have an image
in mind and you can specify the width of the heading or
encapsulating div to suit. But you might run into trouble then if
there is text there and someone resizes...

There are ways of having a very wide image that looks natural at
any width, something landscapy with the right bit having no
particular "aesthetically correct" width. A German motorcyclist
had an example a while back, lost the url...

--
dorayme
Oct 17 '07 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by William C. White | last post: by
2 posts views Thread by Albert Ahtenberg | last post: by
3 posts views Thread by James | last post: by
reply views Thread by Ollivier Robert | last post: by
1 post views Thread by Richard Galli | last post: by
4 posts views Thread by Albert Ahtenberg | last post: by
1 post views Thread by inderjit S Gabrie | last post: by
2 posts views Thread by Jack | last post: by
3 posts views Thread by Sandwick | last post: by
reply views Thread by leo001 | last post: by

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.