Problems:
We want to display something like this.
The container has an image arrow on the right. The content text length is undetermined.
Solution:
We can resort to background to display the image.
/*A padding is put on the right to display the image. The background image is put to the right to fill the padding area. */
p {
background: url("http://images.apple.com/support/home/images/morearrow.png") no-repeat scroll right center transparent;
margin: 0;
padding: 0 9px 0 5px;
}
It is even possible to display 2 background images, one on the left and another on the right.
p{
margin: 0;
padding: 0 9px 0 9px;
background: url("http://images.apple.com/support/home/images/morearrow.png") no-repeat left center, url("http://images.apple.com/support/home/images/morearrow.png") no-repeat right center;
}
Related Patterns:
If we need to display the right image X pixels from the right border, we can not do it with this method because background-position can not do this. So, we may have to use:
- 大小: 647 Bytes
- 大小: 752 Bytes
分享到:
相关推荐
background-image:url(images/bj01.jpg); display:block; margin:0px; padding-top:10px; padding-right:0px; padding-bottom:13px; padding-left:0px; } #daohang a:link,#daohang a:visited{ color:#FFF; ...
background-image: url(images/image.jpg); ``` 3. `background-position`:这个属性控制背景图像在元素内的位置。你可以使用像素或其他长度单位来指定位置,也可以使用关键词如`center`、`top`、`right`等。例如...
banner.style.backgroundImage = 'url(' + images[index] + ')'; index = (index + 1) % images.length; } setInterval(changeBackground, 5000); // 每5秒切换一次 }); ``` 在上述代码中,我们监听了文档加载...
如果需要引用其他目录的图片,可以使用相对路径,如`url(images/image.jpg)`或`url(../images/image.jpg)`。 3. **背景平铺(background-repeat)** 默认情况下,背景图片会在水平和垂直方向平铺。你可以通过`...
- changed the name of image tag to photo tag in images.xml Version 1.0.3.4054 - 14-Feb-11 - renamed the widthComponent and heightComponent attributes from settings.xml to componentWidth and ...
background: url(path/to/image.jpg); } ``` 在提供的示例中,我们看到这样一段CSS代码: ```css html, body { margin: 0; padding: 0; height: 100%; font-family: "Times New Roman"; background: url...
1. **背景图像**:CSS允许将图像设置为元素的背景,通过`background-image`属性实现。可以使用背景平铺、定位和固定等属性进行定制。 2. `content`伪元素:在CSS中,`::before`和`::after`伪元素可以插入内容,包括...
background-image:url(images/header.jpg); } #header ul { padding:272px 0 0 32px; width: 719px; } #header ul li { width:77px; height:18px; float:left; } #header ul li a { text-decoration:...
background-image: url(<#IMG_DIR#>/logo.gif); background-position: left; background-repeat: no-repeat; cursor: pointer; height: 76px; margin: 0px; padding: 0px; width: ...
要使用这个属性,必须先通过background-image属性指定了一个背景图片。background-position属性的位置定位不会受到对象的padding(内边距)属性设置的影响,这表示背景图片的定位是相对于元素的内容区域进行的,不会...
你可以使用URL指定图像路径,如`background-image: url(images/search.png);`,这里的`search.png`是图片文件名,`images`是图片存放的目录。 `background-position`用来控制背景图像的位置。在上述示例中,`...
background-image: url(images/bg.gif); background-repeat: repeat; } ul,li,h2{margin:0;padding:0;} ul{list-style:none;} #top{ width:909px; height:26px; background-image: url(images/h2bg.gif); ...
动态爱心表白代码 html js网页源代码 情人节送女友礼物浪漫编程,七夕程序员表白Html代码表白的套路很多,但都少不了送花送礼物,作为一个程序员,搞不懂现在流行的泡泡机、小猪、重力感应车等玩具,也不想去让朋友...
background: url(/images/paper.gif); background-position: left top; background-repeat: repeat; padding: 20px; width: 200px; height: 150px; } #rcorners4 { border-radius: 15px 50px 30px 5px; ...
background:url(../images/bg2.jpg)no-repeat; background-color:#FFF; -webkit-background-size: cover; -moz-background-size: cover; background-size: cover; background-attachment: fixed; background...
+ improved image rendering code for transparent (PNG) images. They will be drawn transparently also when scaled and also in high resolution rendering mode. + new code to draw dotted lines ...
document.body.style.backgroundImage = 'url(' + this.src + ')'; } } ``` ##### 4. 注意事项 - **获取body元素对象**:确保正确地获取`document.body`,这是更改页面背景的关键。 - **背景图片路径的拼接**:在...
Fixed : Issue with popupmenu on background interfering with scrolling interaction in TTMSFMXTableView Fixed : Issue with selection persistence of items when scrolling in TTMSFMXTableView Fixed : ...