惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

T
Tenable Blog
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
Google Online Security Blog
Google Online Security Blog
T
Threat Research - Cisco Blogs
D
Darknet – Hacking Tools, Hacker News & Cyber Security
W
WeLiveSecurity
NISL@THU
NISL@THU
V
Vulnerabilities – Threatpost
V2EX - 技术
V2EX - 技术
Cisco Talos Blog
Cisco Talos Blog
Simon Willison's Weblog
Simon Willison's Weblog
The Last Watchdog
The Last Watchdog
P
Privacy International News Feed
博客园 - 三生石上(FineUI控件)
Recent Announcements
Recent Announcements
酷 壳 – CoolShell
酷 壳 – CoolShell
美团技术团队
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
Scott Helme
Scott Helme
C
Cybersecurity and Infrastructure Security Agency CISA
Cyberwarzone
Cyberwarzone
量子位
Security Archives - TechRepublic
Security Archives - TechRepublic
Microsoft Azure Blog
Microsoft Azure Blog
F
Fortinet All Blogs
H
Hacker News: Front Page
D
Docker
N
Netflix TechBlog - Medium
阮一峰的网络日志
阮一峰的网络日志
G
Google Developers Blog
Hugging Face - Blog
Hugging Face - Blog
腾讯CDC
Last Week in AI
Last Week in AI
H
Hackread – Cybersecurity News, Data Breaches, AI and More
K
Kaspersky official blog
www.infosecurity-magazine.com
www.infosecurity-magazine.com
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
爱范儿
爱范儿
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
小众软件
小众软件
S
Security Affairs
博客园 - 聂微东
AI
AI
Latest news
Latest news
Application and Cybersecurity Blog
Application and Cybersecurity Blog
Engineering at Meta
Engineering at Meta
Cloudbric
Cloudbric
S
Secure Thoughts
Spread Privacy
Spread Privacy
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org

博客园 - birdshome

围观腾讯云输入法如何回发用户输入 《死了都要TRY》——迎接2010 Windows Server 2008 hang up问题 低功耗Atom下载机兼Home Server咯 这里的Windows 3.1你注意到了吗? EeePC 901换装Windows XP的步骤 在Windows 2003下使用QuickCam 自己动手DIY了一个内存散热棒棒糖 微软2008发布会,英雄由{此}诞生! 要参加微软2008三驾车发布的冒个泡 将Nokia 6300 Firmware升级到5.5 别太迷信GMap了,其实YMap也不错 .NET缘,源自.NET,我的2007回顾 你还敢使用window.open弹广告吗? Visual Studio 2008如此改进了图标 技术上根本不思进取的金山词霸2007 北京TechEd 2007 及《微软360度》 2007微软技术大会(TechEd)开幕式 ASP.NET 2.0揭秘(中文版)国庆献礼
将Banner美观的放置于博客首页上
birdshome · 2007-10-26 · via 博客园 - birdshome

    自从alimama推出了方便的按时段展示付费的banner广告位后,我发现博客园中有不少的blog都放上了这种广告位。不过有些广告位放的位置虽然是首页的顶部,但是看起来却十分的不美观。dudu同学为了大家能方便定制自己的blog,开放了一个页首和页尾html嵌入区段,所以我们可以将首页的banner放置的更加美观些。

    原来只有公告那个位置能插入html和脚本的时候,要定制页面确实比较困难,需要

搞一堆的脚本,而且还需要页面加载完毕才能执行(这样才安全)。现在有了首页的html插入设置后,很多事情就方便了。博客园的大多数blog主题都是博客名称在左边,然后右边空出一大块,有的是图片,有的就是一个色块。所以把banner放在这个空出来的区域里面的话,一来利用空间,二来美化了页面,三来到了年底还能有顿大餐的钱,哈哈。

    但是不过直接放入banner的代码,该banner就会直接的出现在页面的最上面,这样的效果似乎就破坏了整个页面的美观。比如:最远距离无意的.net之旅,等等,就不一一列出了。所以我们需要使用一点css对html页面布局的小trick,当然我也不想用javascript,这个东西虽然能搞,但是有点杀鸡用牛刀的感觉。以鸟食轩blog为例,我放的banner代码是:

<iframe frameborder="0" marginheight="0" marginwidth="0" border="0" id="alimamaifrm" name="alimamaifrm" scrolling="no" height="60px" width="468px" style="width:468px;height:60px; float: right; src="http://p.alimama.com/code.php?t=2&i=mm_10055081_148045_158408&w=468&h=60&sz=12&bgc=FFFFFF&bdc=E6E6E6&tc=0000FF&lc=008000&dc=000000"></iframe>

    首先我们需要一个和博客园首页一样宽的容器,为的是让我们的广告能右对齐,而且和浏览器右边是相对的位置关系。加一个div元素,设置其position样式为absolute,宽度为100%,这就相当于套在了博客的header上方:<div style="position:absolute; width: 100%;"> </div>

    然后修改一下iframe的float和margin样式,把iframe放在div元素里面,在放入“首页html代码”中:

<div style="position:absolute; border: solid 0px red; width: 100%;"><iframe frameborder="0" marginheight="0" marginwidth="0" border="0" id="alimamaifrm" name="alimamaifrm" scrolling="no" height="60px" width="468px" style="width:468px;height:60px; float: right; margin: 8px;" src="http://p.alimama.com/code.php?t=2&i=mm_10055081_148045_158408&w=468&h=60&sz=12&bgc=FFFFFF&bdc=E6E6E6&tc=0000FF&lc=008000&dc=000000"></iframe></div>


    这时再打开你的blog,banner就美观的出现在了自己blog首页的右端:
    BannerAd.png
    而且resize浏览器,也是一直保持右对齐。由于firefox处理box模型和IE有差别,在IE中显示位置perfect的banner,在firefox中会从右边撑出去一点。不过总的来说也还不算太凌乱吧。