[SOLVED] css: how do i indent text by one or two spaces away from the left side of th

This is a discussion on "[SOLVED] css: how do i indent text by one or two spaces away from the left side of th" within the Web Page Design section. This forum, and the thread "[SOLVED] css: how do i indent text by one or two spaces away from the left side of th are both part of the Design Your Website category.



Go Back   Webforumz.com > Main Forums > Design Your Website > Web Page Design

Notices


Closed Thread
 
LinkBack Thread Tools
  #1 (permalink)  
Old Sep 24th, 2007, 07:41
Junior Member
Join Date: Dec 2006
Location: uk
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts
[SOLVED] css: how do i indent text by one or two spaces away from the left side of th

I am using the code shown here: http://webdesign.about.com/od/css/a/aa072406.htm

Code: Select all
.container {background:#ccc; color:#fff; margin:0 15px;}
.rtop, .rbottom{
display:block;
background:#fff;
}
.rtop *, .rbottom *{
display: block;
height: 1px;
overflow: hidden;
background:#ccc;
}
.r1{margin: 0 5px}
.r2{margin: 0 3px}
.r3{margin: 0 2px}
.r4{
margin: 0 1px;
height: 2px
}
Code: Select all
<div class="container">
<b class="rtop"><b class="r1"></b> <b class="r2"></b> <b class="r3"></b> <b class="r4"></b></b>
CONTENTS GOES HERE
<b class="rbottom"><b class="r4"></b> <b class="r3"></b> <b class="r2"></b> <b class="r1"></b></b>
</div>
the code works ok, but i would like it tweaked so the text is not so close the the egdes, the top and bottom seems ok but it is the left and right margins that are too close to the edges, can these inner margins be increased so the text is not so close?

thanks in advance for your help

  #2 (permalink)  
Old Sep 24th, 2007, 08:03
Most Reputable Member
Join Date: Feb 2004
Location: Borneo
Age: 27
Posts: 1,608
Blog Entries: 2
Thanks: 0
Thanked 4 Times in 3 Posts
Send a message via Yahoo to Monie
Re: css: how do i indent text by one or two spaces away from the left side of the box

Attached your full code or file (even better) so we know "visually" what is your problem.
Last Blog Entry: ASP Programming Tips and Technique (Oct 26th, 2007)
  #3 (permalink)  
Old Sep 24th, 2007, 08:07
alexgeek's Avatar
Technical Administrator

SuperMember
Join Date: Jul 2007
Location: Webforumz 24/7
Age: 15
Posts: 3,770
Blog Entries: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to alexgeek
Re: css: how do i indent text by one or two spaces away from the left side of the box

Quote:
Originally Posted by monie View Post
Attached your full code or file (even better) so we know "visually" what is your problem.
actually host it if possible
i hate downloading files
Last Blog Entry: 3D Chess in your browser! (Mar 14th, 2008)
  #4 (permalink)  
Old Sep 24th, 2007, 08:12
Most Reputable Member
Join Date: Feb 2004
Location: Borneo
Age: 27
Posts: 1,608
Blog Entries: 2
Thanks: 0
Thanked 4 Times in 3 Posts
Send a message via Yahoo to Monie
Re: css: how do i indent text by one or two spaces away from the left side of the box

Quote:
Originally Posted by alexgeek View Post
actually host it if possible
i hate downloading files
LOL...
Last Blog Entry: ASP Programming Tips and Technique (Oct 26th, 2007)
  #5 (permalink)  
Old Sep 24th, 2007, 09:48
Junior Member
Join Date: Dec 2006
Location: uk
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts
Re: css: how do i indent text by one or two spaces away from the left side of the box

Code: Select all
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body bgcolor="507BCD">
<style type="text/css">
.container {background:#FF0000; margin:0 5px;}
.rtop, .rbottom{
display:block;
background:#507BCD;
}
.rtop *, .rbottom *{
display: block;
height: 1px;
overflow: hidden;
background:#FF0000;
}
.r1{margin: 0 5px}
.r2{margin: 0 3px}
.r3{margin: 0 2px}
.r4{
margin: 0 1px;
height: 2px
}
</style>
<table width="100">
  
                <?
                for ($i = 0; $i < 10; $i++) { ?>
                <tr><td>

                <div class="container">
                <b class="rtop"><b class="r1"></b> <b class="r2"></b> <b class="r3"></b> <b class="r4"></b></b>
                <a href="?v=<?=$i;?>" target="_blank"><font color="#FFFFFF" face="Tahoma">description</font></a>
                <b class="rbottom"><b class="r4"></b> <b class="r3"></b> <b class="r2"></b> <b class="r1"></b></b>
                </div>

                </td></tr>
                <? } ?>
  
</table>
</body>
</html>
  #6 (permalink)  
Old Sep 24th, 2007, 10:58
welshstew's Avatar
Lead Administrator

SuperMember
Join Date: May 2007
Location: inside the outside
Posts: 1,388
Blog Entries: 13
Thanks: 1
Thanked 17 Times in 15 Posts
Re: css: how do i indent text by one or two spaces away from the left side of the box

Hi Jason,

In order to add padding or margin space around elements you need to add the margin:{Top Right Bottom Left ;} or padding:{Top Right Bottom Left ;} proporties to your class attributes.

So, using your code as an example. If I wanted to add 10px margin space to the left and right of the r1 class I would do the following:
Code: Select all
.r1:{margin: 0px 10px 0px 10px;}
There are some great css resources that karinne has outlined here.

Good luck.

Stew
__________________
WelshStew
Lead Administrator

tierney rides tboard - uk site | xtreme wales - extreme clothing
If you think I've helped, click the "Thanks"
webforumz - facebook | LinkedIn
Last Blog Entry: Web Standards Curriculum Launched (Jul 8th, 2008)
  #7 (permalink)  
Old Sep 24th, 2007, 11:02
SuperMember

SuperMember
Join Date: Sep 2006
Location: Pink House
Posts: 3,946
Thanks: 0
Thanked 0 Times in 0 Posts
Re: css: how do i indent text by one or two spaces away from the left side of the box

How about adding left and right padding to the container?
  #8 (permalink)  
Old Sep 24th, 2007, 11:22
Junior Member
Join Date: Dec 2006
Location: uk
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts
Re: css: how do i indent text by one or two spaces away from the left side of the box

ok i have tried them and sort of see how it works, but still no closer to getting the effect i need,
the text is flush to the side of the container? i have tried to add the margin and padding but these do not move the text in and away from the side , i need a one or two space gap from the edge of the left hand side of the contain, i think thats what it is.

i need it a bit like this


( hello )

at the moment it is like this

(hello )
  #9 (permalink)  
Old Sep 24th, 2007, 12:20
SuperMember

SuperMember
Join Date: Sep 2006
Location: Pink House
Posts: 3,946
Thanks: 0
Thanked 0 Times in 0 Posts
Re: css: how do i indent text by one or two spaces away from the left side of the box

You should specify a width on your container div:
Code: Select all
.container {background:#FF0000; margin:0 5px;}
.rtop, .rbottom{
display:block;
background:#507BCD;
width: whatever you need;
padding 0px 3px;
}
That should add spacing.
  #10 (permalink)  
Old Sep 25th, 2007, 01:37
Most Reputable Member
Join Date: Feb 2004
Location: Borneo
Age: 27
Posts: 1,608
Blog Entries: 2
Thanks: 0
Thanked 4 Times in 3 Posts
Send a message via Yahoo to Monie
Re: css: how do i indent text by one or two spaces away from the left side of the box

Quote:
Originally Posted by Jason3107 View Post
ok i have tried them and sort of see how it works, but still no closer to getting the effect i need,
the text is flush to the side of the container? i have tried to add the margin and padding but these do not move the text in and away from the side , i need a one or two space gap from the edge of the left hand side of the contain, i think thats what it is.

i need it a bit like this


( hello )

at the moment it is like this

(hello )
It's got nothing to do with your div element!
If you want to do it the "CSS way", do it the "CSS way". Throw away all the <font> element and use <p> or <h1> instead.
Code: Select all
<div class="container">
                <b class="rtop"><b class="r1"></b><b class="r2"></b> <b class="r3"></b><b class="r4"></b></b>
                <a href="#" target="_blank"><h1>description</h1></a>
                <b class="rbottom"><b class="r4"></b><b class="r3"></b> <b class="r2"></b><b class="r1"></b></b>
                </div>
and you need to add this to your CSS
Code: Select all
h1 {
    text-align: center;
    font: small tahoma; 
    font-size: 12px;
    font-weight: bold;
    color: black;
    margin: 0 0;
    padding: 0;
}
Last Blog Entry: ASP Programming Tips and Technique (Oct 26th, 2007)
  #11 (permalink)  
Old Oct 1st, 2007, 09:27
Most Reputable Member
Join Date: Feb 2004
Location: Borneo
Age: 27
Posts: 1,608
Blog Entries: 2
Thanks: 0
Thanked 4 Times in 3 Posts
Send a message via Yahoo to Monie
Re: css: how do i indent text by one or two spaces away from the left side of the box

Did you sort it out jason3107?
Last Blog Entry: ASP Programming Tips and Technique (Oct 26th, 2007)
  #12 (permalink)  
Old Oct 1st, 2007, 10:38
Junior Member
Join Date: Dec 2006
Location: uk
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts
Re: css: how do i indent text by one or two spaces away from the left side of the box

just going to test it out now
  #13 (permalink)  
Old Oct 2nd, 2007, 02:08
Most Reputable Member
Join Date: Feb 2004
Location: Borneo
Age: 27
Posts: 1,608
Blog Entries: 2
Thanks: 0
Thanked 4 Times in 3 Posts
Send a message via Yahoo to Monie
Re: css: how do i indent text by one or two spaces away from the left side of the box

I have tested them and it works fine, at least that is my solution.
Maybe there is another solution, for that you have to wait for other member in this forum to give their idea.
Last Blog Entry: ASP Programming Tips and Technique (Oct 26th, 2007)
  #14 (permalink)  
Old Oct 2nd, 2007, 10:24
Junior Member
Join Date: Dec 2006
Location: uk
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts
Re: css: how do i indent text by one or two spaces away from the left side of the box

yes sorry i did not reply sooner, that is exactly what i needed,
thanks
  #15 (permalink)  
Old Oct 2nd, 2007, 10:52
welshstew's Avatar
Lead Administrator

SuperMember
Join Date: May 2007
Location: inside the outside
Posts: 1,388
Blog Entries: 13
Thanks: 1
Thanked 17 Times in 15 Posts
Re: css: how do i indent text by one or two spaces away from the left side of the box

can you please mark as solved, thanks
__________________
WelshStew
Lead Administrator

tierney rides tboard - uk site | xtreme wales - extreme clothing
If you think I've helped, click the "Thanks"
webforumz - facebook | LinkedIn
Last Blog Entry: Web Standards Curriculum Launched (Jul 8th, 2008)
Closed Thread

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Always displaying to the left thewebkid Website Planning 10 Nov 19th, 2007 13:41
[SOLVED] Image with text -&gt; text with background alexgeek Web Page Design 5 Nov 13th, 2007 23:25
How to indent aaronh Web Page Design 2 May 11th, 2007 14:19
2 columns of text either side of Flash timmytots Web Page Design 11 Nov 29th, 2005 01:18
Client-Side VS Server Side Scripting redev2006 JavaScript Forum 1 Jul 30th, 2005 19:30


All times are GMT. The time now is 07:07.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43