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

Setting TEXT ONLY margins/padding in a .div

10
Right now I am currently using this:

------------------------------------------------------------
.div0 {
background-image:url(http://www.rubnip.com/Pictures/topback.gif);
background-position:center center;
background-repeat:no-repeat;
background-attachent:fixed;
background-color:black; color:FFFFFF;
border:0px solid; border-color:grey;
padding-left:10px; padding-right:10px;
padding-top:10px; padding-bottom:10px;
width:800px; height:250px; overflow:none;
position:absolute; z-index:2; left:50%; top:0%;
margin-left:-400px; margin-top:150px; text-align:center;
visibility:visible;}
--------------------------------------------------------------

The only problem is, when I use that padding setting within the divider, it also moves my background image. I just want to set a margin or padding that affects the text within the divider only, not the background image. How would this be done?

---------------------------------------------------------------
<div class="bbzContainer">
<div class="div0">
<font size=1>Test</font>
</div>
---------------------------------------------------------------

Or maybe I can put something in there in the font tag that will affect only the text?

Any help is appreciated. :)
Nov 30 '06 #1
12 22095
drhowarddrfine
7,435 Expert 4TB
You are applying the margin/padding to the div so that's why the background moves. You don't have any positioning applied to the text itself and font is not positionable anyway. The <font> tag also went the way of the do-do bird. Do not use it.

Instead, either enclose your tag in a paragraph, <p> tag, or, if it's a heading, call it that: <h1>, <h2> and so on. Then you can position it in your css like so:

h1{margin:20px}

Then you are applying positioning to the text and not the div.
Nov 30 '06 #2
mi0sis
10
You are applying the margin/padding to the div so that's why the background moves. You don't have any positioning applied to the text itself and font is not positionable anyway. The <font> tag also went the way of the do-do bird. Do not use it.

Instead, either enclose your tag in a paragraph, <p> tag, or, if it's a heading, call it that: <h1>, <h2> and so on. Then you can position it in your css like so:

h1{margin:20px}

Then you are applying positioning to the text and not the div.
OK where exactly do I put the "h1{margin:20px}"? Anywhere in my style sheet? Or is there some place in particular?

Thanks for the heads up on the <font> tag too. I've kinda been out of the web coding loop and I'm learning CSS at the moment.

So I'll define all my text properties in the "h1{margin:20px}" class and whatever I put between my <h1> <p> <h2> tags will be adjusted according to how the each class is defined (h1, p and h2 each respectively) correct?

P.S. Do I need a semicolon in "h1{margin:20px}" after the 20px?
Nov 30 '06 #3
mi0sis
10
OK where exactly do I put the "h1{margin:20px}"? Anywhere in my style sheet? Or is there some place in particular?

Thanks for the heads up on the <font> tag too. I've kinda been out of the web coding loop and I'm learning CSS at the moment.

So I'll define all my text properties in the "h1{margin:20px}" class and whatever I put between my <h1> <p> <h2> tags will be adjusted according to how the each class is defined (h1, p and h2 each respectively) correct?

P.S. Do I need a semicolon in "h1{margin:20px}" after the 20px?
Here is what I tried, it didn't work lol. I assume I am doing it wrong:

p {
magrin-left:10px
margin-right:10px
margin-top:10px
margin-bottom:10px
font-size:1
font-color:FFFFFF}

h1 {
magrin-left:10px
margin-right:10px
margin-top:10px
margin-bottom:10px
font-size:3
font-color:CCCC99}

h2 {
magrin-left:10px
margin-right:10px
margin-top:10px
margin-bottom:10px
font-size:2
font-color:CCCC99}
Nov 30 '06 #4
mi0sis
10
Here is what I tried, it didn't work lol. I assume I am doing it wrong:

p {
magrin-left:10px
margin-right:10px
margin-top:10px
margin-bottom:10px
font-size:1
font-color:FFFFFF}

h1 {
magrin-left:10px
margin-right:10px
margin-top:10px
margin-bottom:10px
font-size:3
font-color:CCCC99}

h2 {
magrin-left:10px
margin-right:10px
margin-top:10px
margin-bottom:10px
font-size:2
font-color:CCCC99}
Whoops spelled on of the "margins" wrong. X_X
Nov 30 '06 #5
mi0sis
10
Oh yeah, not to ask 5000000 questions but, is there anyway I can make the scrollbars affected by the margin? I.E. Say the divider is 400px in height, I have margins on top and bottom set to 20, the scrollbars only scroll between pixels 21 and 379.

Thanks again for all the help. :D
Nov 30 '06 #6
mi0sis
10
Oh yeah, not to ask 5000000 questions but, is there anyway I can make the scrollbars affected by the margin? I.E. Say the divider is 400px in height, I have margins on top and bottom set to 20, the scrollbars only scroll between pixels 21 and 379.

Thanks again for all the help. :D
OK, I fixed all the margins and got them working. :)

My question still stands about the scrollbars though, any way to get them to obey margins?

Thanks again.
Nov 30 '06 #7
AricC
1,892 Expert 1GB
OK, I fixed all the margins and got them working. :)

My question still stands about the scrollbars though, any way to get them to obey margins?

Thanks again.
Jumping in late on this but what do you mean by scroll bars obey the margins?
Nov 30 '06 #8
drhowarddrfine
7,435 Expert 4TB
Do I need a semicolon in "h1{margin:20px}" after the 20px?
Only to seperate other attributes of the same element, so, no.
font-size:1
font-color:FFFFFF}
font-size requires a unit type, such as ems or px. font-color requires a # before the number, ie, #ffffff. Case matters in CSS so use lower case.
http://www.w3.org/TR/CSS21/fonts.html#propdef-font-size

CSS Full Property Table

I don't know what is meant by the scrollbars, too.
Nov 30 '06 #9
mi0sis
10
Only to seperate other attributes of the same element, so, no.
font-size requires a unit type, such as ems or px. font-color requires a # before the number, ie, #ffffff. Case matters in CSS so use lower case.
http://www.w3.org/TR/CSS21/fonts.html#propdef-font-size

CSS Full Property Table

I don't know what is meant by the scrollbars, too.
Thanks again for the help.

OK, let's see here how can I describe what I mean here about the scrollbars.

Well OK let's say I have this 400 x 400 divider. If I have text and images that exceeds that size it will cause an overflow. I currently have my overflow set to "auto" so that in turn will create a scrollbar within' the divider so you can see the text and images in the divider that have gone over the height and width specifications.

My problem is, the scrollbars span the entire length of the divider, I.E. they start at pixel 0 and go all the way to pixel 400. By doing this, when you scroll through the divider the text also goes all the way to pixel 0 and 400 when clipping off the divider. So is there a way I can set the scrollbar height to match the size 380 x 380 (Starting at pixel 21 and ending at pixel 379) so that the text doesn't go all the way to the very edge of the divider when it scrolls off?

Here is the site I am working on:

http://www.myspace.com/fullofstupidandlose

Note: Contains obscenities.

If you look at any of the dividers with scrollbars you can see I have a background image that is supposed to appear as a window for the text to sit in. When you scroll up or down though, the text overlaps that image and goes all the way to the edge of the divider.

I hope this helps to clarify. I think that's the best way I can describe it. Thanks much guys. :)
Nov 30 '06 #10
mi0sis
10
Or here is another way I guess it could be done, is there a way to limit the size of the box that the text sits within' the divider so I can make that smaller in turn making the scrollbars smaller?
Nov 30 '06 #11
mi0sis
10
OK, I have been thinking about this, and it seems what I am trying to do doesn't make sense or isn't possible. Since the overflow setting of the divider is for the divider, not the text and soon as the divider reaches its' clipping limit it creates a scrollbar for the divider, not the text.

So I think what I need to do here, is put the text within something else inside of the divider.

Is there any kind of element or tag I can put the text in, inside the divider that has a separate overflow value from that of the divider? This way I can set a dimensions for that and if my text exceeds it, it will create a scrollbar within the bounds of that element instead of the divider.

Maybe a table or something? Better yet, another divider? Actually I think I'll try overlapping a divider.

New question, do I have to set any certain command to make sure my new divider is on top of the old one and visible?

Thanks again. :)
Dec 1 '06 #12
mi0sis
10
Maybe a table or something? Better yet, another divider? Actually I think I'll try overlapping a divider.

New question, do I have to set any certain command to make sure my new divider is on top of the old one and visible?

Thanks again.
Got this to work. Everything seems to be working as I want it to. Thanks again for the help. :D
Dec 1 '06 #13

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Mr. x | last post by:
Hello, Suppose I have a table like this : <table width = "580"> <tr align = "right" width = 760> <td id = "current_page_inner"> <font size="4" color="lightgreen" face="arial"><b><i> abc...
4
by: Mike | last post by:
The following (C#) code snippet sets the text property of a label to null, then tests it for null, only to find out that is isn't. Can anyone explain why? Label1.Text = null; if (Label1.Text...
0
by: John Dalberg | last post by:
I need to set IE's print left margin to a value smaller than the default 0.75 programmaticallly. I did some research and found some info about print templates on MSDN. However the info is too...
6
by: one man army | last post by:
> <URL:http://developer.mozilla.org/en/docs/DOM:element.textContent> I tried setting the textContent on a trivial DIV text element. Querying the result with window.alert() shows that it worked....
1
HansHenrik
by: HansHenrik | last post by:
Hi experts! I've made a CSS menu. {The menu contains: no images; !important} I would like to position my text close to the bottom in my list-items as in example 02 and 03. At the moment...
4
by: NEMA | last post by:
Hello everyone, i have a problem while setting the button text recently for my case, i would like to set the text of the button on the aspx page, i have write the code like below ...
10
by: maya | last post by:
hi, I'm having a problem w/bulleted lists.. as you know FF and IE do diff margins/spacing for these, so have to do stuff like /* IE: */ * html ul.headlines {margin-left:20px; margin-top:0px;...
0
by: Alexnb | last post by:
I am writing a program in which there is a textbox and in it the program auto inputs a series of words, and definitions for each word. I want to make it formatted nicely to where the word is...
0
by: Bill Eberle | last post by:
In Access 2007 ADP connected to SQL Server Express, most forms allow Text Format attribute of Rich Text, but a few do not. In each case the SQL Server table field connected to the Access Text Box is...
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
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
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: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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...
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...

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.