简体   繁体   English

具有内容div,wordpress的css全宽背景

[英]css full width background with content div, wordpress

I am using a wordpress theme for my portfolio site and I am trying to recreate an effect that I see many sites using now. 我正在为我的投资组合网站使用wordpress主题,并且尝试重新创建一种效果,使我看到现在很多网站都在使用它。 Its essentially a full width background image or css background color with standard page width content. 它本质上是具有标准页面宽度内容的全角背景图像或CSS背景颜色。

Here is an example: http://themeforest.net/item/vernumresponsive-onepage-parallax-wordpress-theme/full_screen_preview/4843905 这是一个示例: http : //themeforest.net/item/vernumsensitive-onepage-parallax-wordpress-theme/full_screen_preview/4843905

When you go about half way down the page you will see the "Are you ready to buy this theme" section. 当您浏览页面的一半时,将看到“您准备好购买此主题了”部分。 Its like a page break with content. 就像是分页显示内容一样。 I want to do that in wordpress, but I don't need to have the parallax effect. 我想在wordpress中这样做,但是我不需要视差效果。 I just need the image background or background color css to break the initial content container, but keep the content inside it confined to that container. 我只需要图像背景或背景色CSS来破坏初始内容容器,但将其中的内容限制在该容器内即可。

You can use shortcode in your theme. 您可以在主题中使用简码。

Example : 范例:

in your theme : 在您的主题中:

function fullWidthBreak_func( $atts ){<br/>
extract( shortcode_atts( array(
'content' => 'default content'
), $atts ) );
return "some css to full widht : $content";<br/>
}<br/>
add_shortcode( 'fullWidthBreak', 'fullWidthBreak_func' );


in your post: 在您的帖子中:

some content before<br/>
[fullWidthBreak content="some content inside"]
some content after<br/>

Reference : 参考:

http://codex.wordpress.org/Shortcode_API http://codex.wordpress.org/Shortcode_API

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM