What is the best semantic and valid method to make

2019-08-30 05:11发布

What is the best semantic and valid method to make drop shadow around whole #wrapper? on all side. horizontally can be fixed but vertically should be expandable.

标签: css xhtml
3条回答
爱情/是我丢掉的垃圾
2楼-- · 2019-08-30 05:57

If you are willing to go with another, non semantic method for IE, you could simply use CSS 3 for current (Webkit and Gecko based) browsers:

box-shadow: 10px 10px 5px #888;
padding: 5px 5px 5px 15px;


(source: css3.info)

Of course, for IE you have a few other options.

The last one has the advantage of given you the chance of using the CSS box-shadow on CSS3 enabled browsers, and the Javascript drop shadow on the rest (IE/Opera).

查看更多
我欲成王,谁敢阻挡
3楼-- · 2019-08-30 06:05
  • Some JavaScript trick
  • CSS3 or custom browser styles
  • Use images around the #wrapper

Shadows can hardly be made semantically correct since they have no meaning. It's just a decoration (presentation) element.

查看更多
啃猪蹄的小仙女
4楼-- · 2019-08-30 06:11

If the width is fixed I wouldn't use a wrapper I'd do like that:

<div class="box-header">
</div>
<div class="middle">
my content
</div>
<div class="box-footer">
</div>

For top and bottom classes I'd put the top and bottom shadows as a css background image.

Then I'd repeat-y a background image representing shadows on both sides of the box.

If you don't care about cross-browser compatibility, prefer using CSS3 properties.

查看更多
登录 后发表回答