-2

I'll try to explain my "Problem". I want to add on a search bar on a page, using CSS Stylesheet

<form action="/site/shop_skin.php" method="post">
    <img src="/site/img/pictos/mini_search_white.jpg" align="absmiddle">
    <strong> Rechercher</strong>
    <br>
    <input name="search" id="search" size="15" maxlength="15" style="" type="text">
</form>

I want to take this code to an other page but I don't know how to "convert" it into CSS

Maybe I can make it understand more easily this way: I need a search bar (Searching into "/site/shop_skin.php") that I can put into my CSS Stylesheet, so "img" and "Rechercher" are really not important

Thanks to anyone that will try to help me ;)

Btw: I'm making my Stylesheet with Stylish (If it may change anything)

  • 1
    Perhaps i'm in the minority, but I have no idea what you're asking for... *"I need a search bar that I can put into my css stylesheet"*...? Can you take a step back and just explain on a more broad-level what you're trying to achieve, like "I want my search bar to look like this", or "I want this to be aligned like this", etc? The way you've described this is quite unclear. – Tyler Roper Jun 23 '17 at 13:53
  • As I said, basically I just want to take this code and put it on an other page by using my CSS Stylesheet – Max Clerk Jun 23 '17 at 13:55
  • Again, I'm completely unclear. CSS is a styling language. It can change the color of things, position things, align, etc. It cannot "move code" from one page to another. The only way CSS can "inject" content is using pseudo-elements, but these are plaintext. You can't create HTML elements like images. – Tyler Roper Jun 23 '17 at 13:57
  • Thats the point I wasnt sure because I didnt found any post about what i was trying to do, so I cant add this code on an other page using CSS Stylesheet if I understand? – Max Clerk Jun 23 '17 at 13:59
  • What you want to convert to CSS is HTML. This is impossible at that level. CSS provides HTML with styling for presentation purposes. HTML provides a layout structure for a webpage. If you want to 'move' code to another location, you'll want to use JavaScript. – zer00ne Jun 23 '17 at 13:59
  • 1
    The code itself cannot be moved, no. That being said, you may be able to get creative with pseudo-elements to replicate the *appearance*, however tags like `
    ` can't be recreated in CSS.
    – Tyler Roper Jun 23 '17 at 14:00
  • Ok I see, I wasnt sure because I started CSS not that long ago, thanks alot for your help guyz :) – Max Clerk Jun 23 '17 at 14:04
  • Possible duplicate of [Adding HTML entities using CSS content](https://stackoverflow.com/questions/190396/adding-html-entities-using-css-content) – Gerry Jun 23 '17 at 16:47

2 Answers2

0

You can do it in 2 ways, put the form code inside an HTML file and include that file with PHP's include() function or load the file with jQuery's load() method. The other way is to create the element from scratch using Javascript and include that Javascript file in every page.

TripleDeal
  • 726
  • 4
  • 14
0

Thanks to the ones who answered, but apparently, as Santi said, I can't move the code without using JS (That is impossible cuz I'm using Stylish)

So it's impossible to do it the way I was trying to!