/    Sign up×
Community /Pin to ProfileBookmark

align doesn’t work

I made a CSS class

[CODE].backgroundlayer {
height: 100%;
width: 800;
background-color: #EFDFC9;
margin: 0px 0px 0px 0px;
padding: 0px 0px 0px 0px;
text-align: center;
text-vertical-align: top;
}[/CODE]

And all other site content is within this table class, but the align doesn’t seem to work.

Am I doign something wrong?

to post a comment
CSS

10 Comments(s)

Copy linkTweet thisAlerts:
@toicontienSep 22.2006 — The text-align property only applies to inline tags, like b, i, span, strong, a, and text. If you want to center block elements or tables, you have to use auto left and right margins:
<i>
</i>body {
text-align: center; /* For IE5-Win */
}

#wrapper {
margin: 0 auto;
text-align: left;
width: 770px;
}

[code=html]
<div id="wrapper">
<!-- Page content goes here -->
</div>
[/code]

The text-vertical-align property is an invalid CSS property. The vertical-align property is valid and aligns things vertically in two cases:

1) vertical-align is applied to a TD tag. It vertically aligns all content within the table cell.

2) vertical-align is applied to an inline element: It vertically aligns that inline element in the line-box in which it exists. Basically, it vertically aligns the tag with respect to the line of text.

And that's it. Vertical-align doesn't work on anything else or in any other situation.

What are you trying to achieve?
Copy linkTweet thisAlerts:
@mark_yiehSep 22.2006 — I disagree with toicentien. Text-align does work for block level elements. As a matter of fact, it only works for block level elements. Inline elements will only be as large as the content it contains, therefore there is no need to use text-align for inline elements. the thing to remember when using text-align is to put it in the parent element. For example:

<div style="width: 500px; text-align: center;">

<p>This paragraph is going to be aligned center.</p>

</div>

vertical-align is the same thing as text-align except for the vertical aspect. And it's vertical-align, not text-vertical-align.

Just by looking at that one css rule, I can't tell if you're doing anything wrong. i have to see the rest of the css and the html.
Copy linkTweet thisAlerts:
@felgallSep 22.2006 — text-align only works for text. If you want to align anything other than text you need to use margin:auto for centring and float:left and float:right to align to the left and right respectively. In all cases these only applies to block elements.
Copy linkTweet thisAlerts:
@HellusiusauthorSep 22.2006 — well I just tried using <center> in html before I declare the table with the class, btu that doesn't seem to work either, really odd.

and another question, can I preset the values of the TD within each class?
Copy linkTweet thisAlerts:
@HellusiusauthorSep 22.2006 — If you want to see the website [url=http://warnicro.awardspace.com/portofolio/index.php]click here[/url]
Copy linkTweet thisAlerts:
@HellusiusauthorSep 22.2006 — suggestions?
Copy linkTweet thisAlerts:
@ray326Sep 22.2006 — Text-align does work for block level elements. As a matter of fact, it only works for block level elements.[/QUOTE]Text-align doesn't work [B]ON[/B] block elements, it works on the [B]CONTENT[/B] of the block element to which it applies. (Assuming we're talking about web browsers and not IE.)
Copy linkTweet thisAlerts:
@ray326Sep 22.2006 — What is it exactly that isn't centered that is supposed to be? If it's the whole content area then change the margin to [B]margin: 0 auto;[/B] in that class.
Copy linkTweet thisAlerts:
@HellusiusauthorSep 22.2006 — well the whole brown piece from top to bottom of the screen should be centered instead of on the left side of the screen.
Copy linkTweet thisAlerts:
@ray326Sep 23.2006 — Ok then what I said works for that aspect of it.
×

Success!

Help @Hellusius 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 6.16,
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: @nearjob,
tipped: article
amount: 1000 SATS,

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

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...