/    Sign up×
Community /Pin to ProfileBookmark

borders and padding in container,box and cards

Hi,
i wanted to ask a few question about containers, boxes and cards,and using them for layout purposes… can we assign borders to just lefthand side and on the top of one card or container…..? or horizontal sides, or vertical sides let’s say? and can we assign different colors to borders on different sides?

And about padding, can we assign different padding for each side of the container/box/card at the same time? (i think i came across something like his before, but i coldn’t find it again ? sorry if i am duplicating something )
If you guys can direct me to some tuorial about these, or if you can show me some examples (if u have time ofcourse) i’ll be thankful

And one more thing, how to align a text center in a container??? (i used text-align:center in <h2….> tag, it didn’t work. i put a <div align=center> and </div> after that <h2> part, but it didn’t center the box, it floated right)

thanx

to post a comment
CSS

2 Comments(s)

Copy linkTweet thisAlerts:
@ray326Aug 09.2007 — Yes to all the "different" questions. Lengths can be set in the shorthand forms like [B]padding: 10px 20px 5px 0;[/B] but border colors and styles have to be done per side as in [B]border-right: 1em solid #33e;[/B].

text-align:center should do it for any block element container like an h2. A div inside an h2 (or any h?) is invalid.
Copy linkTweet thisAlerts:
@hmtpnauthorAug 09.2007 — thanx ray, guite short but soo useful explanation ?
×

Success!

Help @hmtpn spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...