CSS sets the dimensions of the SPAN element:
The dimensions of the span element cannot be set by default, and can only be adapted to the size of the content, meaning that the default condition for setting the width and Height properties for a SPAN element is not valid. This occurs because the span element is an inline element and the inline element cannot be sized, as long as it is set to block-level or inline block-level elements.
The code example is as follows:
<!DOCTYPE HTML> <HTML> <Head> <MetaCharSet= "Utf-8"> <Metaname= "Author"content= "http://www.softwhy.com/" /> <title>Ant Tribe</title> <styletype= "Text/css">#antzone{width:200px;Height:100px;background:Green;Display:Block;}</style> </Head> <Body> <spanID= "Antzone"></span> </Body> </HTML>
After the code adds the span element to the Display:block property, you can set it as a block-level element, you can set the size, or use Display:inline-block to set it to inline block-level elements, or you can implement the same functionality.
The original address is: http://www.softwhy.com/forum.php?mod=viewthread&tid=13408
For more information, refer to: http://www.softwhy.com/divcss/
CSS setting the dimensions of a SPAN element