...

View Full Version : Indent with CSS



tboss132
01-27-2005, 12:16 PM
Hi guys, i'm an extreme newbie to CSS. Just picked it up yesterday and i can already see a lot of advantage over tables. My question now is this. How do i make some text have a 10px indent form both top and left (as opposed to having a table and using Cellpad = 10)

OK, i got this so far. If i remove the colour attribute, it displays a black border. I want the border to be invisible and not display any colour but just to indent the element.


.tab {
border: 10px solid rgb(0,0,0)
}

Thanks

onggie
01-27-2005, 12:33 PM
Hey, quick question! What site are you looking at, to learn how to use it? I really suck at it! Thanks!

Sayonara
01-27-2005, 12:34 PM
.tab {
padding-left: 10px;
}

The only problem with that is that it will apply to the whole of anything styled as .tab. But then so will borders.

Sayonara
01-27-2005, 12:39 PM
Oh yes:


p:first-letter { padding-left: 10px; }

That will do exactly what you want, but it's not supported by IE5, IE6, or Mac IE5.

tboss132
01-27-2005, 12:47 PM
.tab {
padding-left: 10px;
}

The only problem with that is that it will apply to the whole of anything styled as .tab. But then so will borders.

I didn't know someone had replied while i was editing. I added

.tab {
padding-left: 10px;
padding-top: 10px;
}
and now it works fine. Do you think it's better to just put it in the div instead of defining in an external CSS?
Thanks for the info.


Hey, quick question! What site are you looking at, to learn how to use it? I really suck at it! Thanks!
http://www.w3schools.com/css/css_intro.asp
Beautiful site to learn from...

onggie
01-27-2005, 02:43 PM
For some reasoon I find that site very hard to learn from, but thanks anyway!

tboss132
01-27-2005, 02:56 PM
Well onggie, you could do a google
http://www.google.com/search?q=css%20tutorials
As expected w3schools :D will be the first on the list.

Thanks again Sayonara.

Jalenack
01-27-2005, 06:49 PM
Hey...some standard CSS for indent the first line of a paragraph:

p {
text-indent: 20px;
}

you don't have to use css3 (?) selectors for that. And it works cross-browser in my experience...good luck!

ronaldb66
01-28-2005, 08:20 AM
I don't think he actually meant indentation, since he also need it from the top...

Basically, both margins and padding could be used, depending on whether there's a border and/or a background effect (color or image). In most cases, to create whitespace around any content, margins do the job well.
For any directed recommendations you need to supply a lot more info, though.

I used to recommend W3Schools as a starting place for learning HTML, CSS, etc, and it still has merit, but recently HTML Dog (http://www.htmldog.com/) has come into the picture as a source for pretty nice tutorials. There are many other online resources, though, that usually address more specific topics.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum