473,383 Members | 1,716 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,383 software developers and data experts.

aligning title and paragraphs differently

Hallo,
I'm trying to create boxes that have nicely spaced paragraphs, but a title
that is in a colored line full-width.

Here is my styles:

In the div content I create the framed boxes and give then a padding at the
left of 20px. Problem is that hte title gets the same padding, whereas it
should align at the left frameline of the box.

#content
{
background-color:white;
border:1px solid gray;
padding: 0px 0px 0px 20px;
}

#content h1
{
left:0;
font-size: 1.4em;
font-weight:bold;
font-style: italic;
padding:0px 0px 0px 10px;
margin:0px 0px 0px -20px;
background-color:#CCCC99;
width:100%;
}

I cannot give a negative padding. Is there a solution for this?

--
sjef janssen
http://www.extranet.ou.nl/studie-profiel/836551051.asp
Jun 6 '07 #1
4 1911
Scripsit Sjef Janssen:
Here is my styles:
As usual, a URL would have helped.
In the div content I create the framed boxes and give then a padding
at the left of 20px. Problem is that hte title gets the same padding,
whereas it should align at the left frameline of the box.
No, the h1 element does not get the padding, but the div element's padding
restricts the width available to the h1 element. A simple solution is to set
no padding for the div element but (different) margins for the elements
inside it.
left:0;
What's the point? Are you using positioning in some part of a style sheet?

--
Jukka K. Korpela ("Yucca")
http://www.cs.tut.fi/~jkorpela/

Jun 6 '07 #2
Yes, the content div is positioned inside a complete setup.
I will try setting margins for the elements
Thanks!!
Sjef

"Jukka K. Korpela" <jk******@cs.tut.fiwrote in message
news:tC*********************@reader1.news.saunalah ti.fi...
Scripsit Sjef Janssen:
Here is my styles:

As usual, a URL would have helped.
In the div content I create the framed boxes and give then a padding
at the left of 20px. Problem is that hte title gets the same padding,
whereas it should align at the left frameline of the box.

No, the h1 element does not get the padding, but the div element's padding
restricts the width available to the h1 element. A simple solution is to
set
no padding for the div element but (different) margins for the elements
inside it.
left:0;

What's the point? Are you using positioning in some part of a style sheet?

--
Jukka K. Korpela ("Yucca")
http://www.cs.tut.fi/~jkorpela/

Jun 6 '07 #3
I changed the margins and it looks fine in IE. But in Firefox the H1 box
extends uotside the div box only on the right side. A difference between IE
and Firefox. Is there an easy way to correct this?

Thanxs!! Sjef

"Sjef Janssen" <ma*************@planet.nlschreef in bericht
news:46***********************@text.nova.planet.nl ...
Hallo,
I'm trying to create boxes that have nicely spaced paragraphs, but a title
that is in a colored line full-width.

Here is my styles:

In the div content I create the framed boxes and give then a padding at
the
left of 20px. Problem is that hte title gets the same padding, whereas it
should align at the left frameline of the box.

#content
{
background-color:white;
border:1px solid gray;
padding: 0px 0px 0px 20px;
}

#content h1
{
left:0;
font-size: 1.4em;
font-weight:bold;
font-style: italic;
padding:0px 0px 0px 10px;
margin:0px 0px 0px -20px;
background-color:#CCCC99;
width:100%;
}

I cannot give a negative padding. Is there a solution for this?

--
sjef janssen
http://www.extranet.ou.nl/studie-profiel/836551051.asp


Jun 7 '07 #4
In article <46***********************@text.nova.planet.nl>,
"Sjef" <ma*************@planet.nlwrote:
"Sjef Janssen" <ma*************@planet.nlschreef in bericht
news:46***********************@text.nova.planet.nl ...
Hallo,
I'm trying to create boxes that have nicely spaced paragraphs, but a title
that is in a colored line full-width.
[snip]
I changed the margins and it looks fine in IE. But in Firefox the H1 box
extends uotside the div box only on the right side. A difference between IE
and Firefox. Is there an easy way to correct this?
[snip]

If you want h1 and p elements in the same div, but you want
different indentation (or any other effect) on the h1 compared
to the p's, you have three choices:

- style ALL p elements to have the indentation you want
- create a rule that applies to any p elements within the specific div
- have a second, inner div below the h1

A fourth alternative is to simply leave the h1 _outside_ the div.
Which method to chose and how to code it is left as a minor
exercise for the reader.

I can't help you with explaining why your styles render differently
in IE versus FF, other than to note that the usual reason is errors
in the html or css triggering 'quirks mode' in IE. Either that, or
you are coding for a non-standards compliant browser, then complaining
that a standards-compliant one doesn't break the rules in the same
way...

If you _really_ want help, post a URL so people can see what you are
trying to achieve.
Jun 7 '07 #5

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

Similar topics

5
by: Info 3000 | last post by:
Hi there, Simple question, but headache ! I have a PHP Page like : <HTML> <HEAD> <TITLE>Sunny day !</TITLE> </HEAD>
1
by: Michael Trojacher | last post by:
I got two <div>'s, one of them with float:right, but they aren't aligned hrizontally at the same level, when viewed in ie. in opera it works fine, the second div is on the same height as the first...
40
by: | last post by:
Could someone cite some offical rule or documentation with regard to the <P> tag? I've seen folks put it in between paragraphs... and others wrap it around a paragraph. I'd think to use it...
16
by: C.W | last post by:
I have a top box element that houses the web site title: #top_section { height: 20px; padding: 10px; text-align: left; background: navy; color: white; }
4
by: erikd | last post by:
I'm trying to set up a standard "footer" on my pages. I just discovered by reading this newsgroup that straight html is no good and I need to learn how to do it using css. So I while I'm learning...
10
by: Carolyn Marenger | last post by:
I think this is an easy one, but I have not been able to find it anywhere. In HTML, I used <center><img src="whatever.gif></center> to horizontally center a graphic on a page. What is the CSS...
11
by: designkitt | last post by:
Hello, I am having a problem aligning a cell in a table and have tried everything I can think of to correct this without any luck: It appears that the white area, which is an image in the background...
4
by: Greg Scharlemann | last post by:
I'm having difficulty getting the radio buttons to align vertically with one another and the header (1 2 3 4 5) at the top. Ideally each radio button will be directly below the one above it and...
14
by: gaijinco | last post by:
I was a hobbist web coder for years but I had to sidestep for a while. Now I'm trying to return to it and I'm trying to clarify how am I supposed to do somethings with CSS v.s. HTML and I'm...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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...

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.