Click to See Complete Forum and Search --> : How do I centralise something inside a DIV?
Can someone tell me how I cnetralise something inside a DIV?
I can't see anything in Dreamweaver from the CSS options apart from:
text-align: center;
I've seen elsewhere: <div align="center">
Does this work? Why is it not available as a Class attribute in Dreamweaver?
I've looked elsewhere: and it looks very messy with lots of code needed!
What's the right answer?
Thanks.
OM
toicontien
05-29-2008, 03:11 PM
The text-align: center CSS property and value centers inline content inside the DIV. What exactly are you trying to center? Can you post your HTML and CSS?
not trying to centre anything special.
2 things:
1. an image.
2. a flash component.
the image is centred if i surround with a <p> tag (not sure of it makes a difference)
but the flash component: i'm having trouble with this.
let me know what u think.
thanks.
Declan1991
05-29-2008, 03:41 PM
div {
text-align:center;
}
div *{
margin:auto;
}
what does the * do?
thanks
toicontien
05-29-2008, 04:11 PM
The "*" character is the universal selector in CSS. It literally matches everything. "div *" is a combination of three selectors: the div tag selector, the " " descendant selector, and the "*" universal selector. It means "apply the following styles to everything inside a DIV tag."
Centauri
05-29-2008, 07:06 PM
Block level elements are centred by defining their width and applying auto side margins to the element itself. Inline elements are centred by applying text-align:center to the parent container. Two very different methods depending on the item to be centred.
just to clarify:
div {
text-align:center;
}
div *{
margin:auto;
}
the above will centralise both inline and block?
and: " " descendant selector
what's that!
never heard of that one! :)
thanks.
WebJoel
05-31-2008, 09:37 PM
....
the above will centralise both inline and block?
....centralised
- drawn toward a center or brought under the control of a central authority; "centralized control of emergency relief efforts"; "centralized government"
centered -
1. Being at or placed in the center.
2. Having a specified center. Often used in combination: a soft-centered candy; a yellow-centered daisy.
3. Self-confident, goal-oriented, and well-balanced: "He's a centered guy. He's always seemed to know what he wanted, and gone after it in a concrete way" Vanity Fair.
Can we call this action by the commonly recognized correct nomenclature? "Centralised" doesn't correctly convey what you are trying to do, even though 'we get the idea'. You are trying to "center" content in a DIV. :) "Centralized" means putting it somewhere were we can all get access to it.
Centauri
05-31-2008, 10:05 PM
and: " " descendant selector
what's that!
That is just what the space between the selectors is called. For instance, the space between the id and the p in #container p {} means any p that is a decendant of #container.