Reputation: 11
I have been told that I can use * to make a width fill out the remaining space, ex. with several div
s within another div
.
It works when I write it in the code as well, but... I need a relevant source before I am allowed to use it in my semester project, can anyone help me out?
div {
width:*;
}
Upvotes: 1
Views: 223
Reputation: 50149
You can't use *
on rules, when you're trying to do width:*;
You can use it in selectors though. When used on a selector it means "anything". For example, the following targets anything that has an <li>
as an ancestor.
li * {
/* */
}
Upvotes: 1
Reputation: 6106
The asterisk (*) character is a wildcard selector that will apply a set of styles to every element on the page. For example:
*
{
color:red;
}
The above will set the colour of the text of all elements on the page to "red".
Usually it is not a good idea to use it because it can take a while for the browser to apply this selector to every element on the page, especially if the page contain lots of elements.
Upvotes: -1
Reputation: 35950
It is not valid to use *
. See the CSS3 spec.
You can define width
as an absolute value (like in pixels), percentage, auto
or inherit
.
Extract from the spec:
Values have the following meanings:
<length> - Specifies the width of the content area using a length unit.
<percentage> - Specifies a percentage width. (...)
auto - The width depends on the values of other properties. See the sections below.
Negative values for 'width' are illegal.
Upvotes: 3