473,804 Members | 3,649 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1933
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.tu t.fiwrote in message
news:tC******** *************@r eader1.news.sau nalahti.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.nlschr eef in bericht
news:46******** *************** @text.nova.plan et.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************ ***********@tex t.nova.planet.n l>,
"Sjef" <ma************ *@planet.nlwrot e:
"Sjef Janssen" <ma************ *@planet.nlschr eef in bericht
news:46******** *************** @text.nova.plan et.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
4144
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
4275
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 one. THe two divs are also nested in a third one, which got an absolute height of 15px, but ie ignores that completely. is tehre a way round this, or do i have to live with that? Mike
40
3382
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 effectively, it'd have to be wrapped, correct? Thanks, - Michael
16
2184
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
1887
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 css I took some code from a sample web page, but I don't think it's optimal. What I'm trying to achieve is a horizontal rule at the bottom of the page with a text block left aligned on the left and right aligned on the right. So there would be a...
10
8508
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 way of doing the same? Thanks, Carolyn ----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==---- http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups ----= East and West-Coast Server Farms -...
11
3104
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 of this table within a table is shifted slightly to the right. It's driving me crazy. Any help would be greatly appreciated. Here is the url and the code for the whole page: http://kittelbergerdesign.com/indextest.html <html> <head>...
4
15913
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 the number 1 will be atop the first radio button starting at the left. Any thoughts on how to achieve this? <html> <head> <title></title> <style type="text/css">
14
2438
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 specially having difficulties with center alignment of elements like images and tables. How is the "right" way to do it? (books that I have checked seemed to dodge the issue) I also have a doubt. html-atributes width and height are preferred over...
0
9576
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10567
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10310
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10074
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9138
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7613
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6847
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5515
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
3
2983
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.