0

Is is possible to add an html code to a css style sheet? like setting an css code to work with the html to pass through?

3
  • Post an example. I'm not sure how you'd mix HTML and CSS. Commented Mar 25, 2013 at 2:19
  • 2
    CSS has a property called content. It can only be used with the pseudo elements :after and :before - css-tricks.com/css-content Commented Mar 25, 2013 at 2:22
  • No, you cannot put HTML in a CSS stylesheet. However, you mention WordPress in the title of your question, which means you have PHP available, and many WordPress framework functions to build both HTML and CSS. If you include more details about what you are trying to accomplish and how you've tried to solve the problem a solution may become more evident. Commented Mar 25, 2013 at 2:29

2 Answers 2

1

I'm not sure what it is you're trying to do... but, as far as I know html can not be placed inside style tags or in external style sheets.

Are you trying to do an inline style? like this:

<p style="color:red;">Hello World?</p>

What have you tried?

Sign up to request clarification or add additional context in comments.

5 Comments

No im trying to add an ad to my background of my website being that i cant add it to my sidebars because it doesnt support those type of widgets
i basically want to add my ads one on the left and one on the right to the background where there fixed on the page.. being that the rest of the content moves without the backgrounf
Still need more information a jsFiddle may get you a few more responses.
ive tried to add it to the header but it basically moves with the content.. and i want it fixed with the background - im trying to figure out if there is a way to add html coding to the stylesheet - or if there is a way where it can scroll with the page being that my site supports infinate scrolling
<div style="float:left;"> <script type="text/javascript"><!-- google_ad_client = "ca-pub-2558981689087321"; /* AdVertical */ google_ad_slot = "9183597492"; google_ad_width = 120; google_ad_height = 600; //--> </script> <script type="text/javascript" src="pagead2.googlesyndication.com/pagead/show_ads.js"> </script> </div>
0

Try this:

<div style="position: fixed; left:0px; top:0px"><script type="text/javascript"><!-- google_ad_client = "ca-pub-2558981689087321"; /* AdVertical */ google_ad_slot = "9183597492"; google_ad_width = 120; google_ad_height = 600; //--> </script> <script type="text/javascript" src="pagead2.googlesyndication.com/pagead/show_ads.js">; </script> </div>

1 Comment

using 'position' you can place it any where on the page you like. What is the url?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.