我将css添加到head标签的结尾 [英] i prepend the css to the end of head tag

查看:218
本文介绍了我将css添加到head标签的结尾的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想添加css到head标签,它应该反映的页面,因为我有文本框在我的页面上,当用户添加背景图像url在这个文本框keyup css是在body标签的身体背景中创建。 css for body标签已成功添加到head标签的开头,但对页面背景没有影响:(。

i want to add css to head tag and it should reflect the page like i have text box on my page when user add background image url in this text box on keyup css is created in head tag for body background. css for body tag is successfully added in the start of head tag but no affect on page background :(.

问题是我可以在head标签的末尾添加css吗?它会改变我的身体背景?

question is can i add css at the end of head tag ? it will change my body background ?

我使用jquery这样做,请帮助

i am doing this using jquery, Please help

推荐答案

使用下面的代码和语法获得解决方案。

got solution using code and syntax below.

可以添加多个类和id选择器来更改页面的完整布局。

multiple class and id selectors can be added to change the complete layout of page.

它只会改变背景图片

$("head").append("<style type=\"text/css\" charset=\"utf-8\">body{background:url("+yourimage variable +") top repeat-x;}");

和多个css类可以使用下面

and multiple css class can be added using below

$("head").append("<style type=\"text/css\" charset=\"utf-8\">body{background:url("+bgimg+") top repeat-x;}#modulebasicInfo{background:#000;}");

这篇关于我将css添加到head标签的结尾的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆