Jump to content

CSS & PHP


{A_K_A}

Recommended Posts

Hi guys,I am quite new to both CSS and PHP and have a CSS question.I have some php code which displays buttons links which it gets from a sql db. my question is how do I use CSS to style the buttons so for eg i want that buttons to appear on the top left.Thanks for your help :)

Link to comment
Share on other sites

Create the CSS like you would without PHP with the selector being a class name, and assign the elements with that name.
Hi,Thanks for your help but i cant seem to get this to work.this is the line I want to style: print '<input type ="button" class="groovybutton" onclick="" onMouseOver="goLite(this.form.name,this.name)" onMouseOut="goDim(this.form.name,this.name)" value ='. "$ques" .'>' .'<br>';How would I apply a selector to this.Thanks for your help.
Link to comment
Share on other sites

<style type="text/css">  .groovybutton {	// This is where you will write your CSS for groovybutton button(s)  }</style>

I was told that it is good practice to make the CSS file separate.where it says class="groovybutton", the groovybutton already refers to some thing in my CSS file, I would like to create another class mb which would align the buttons to the top left. Thanks again
Link to comment
Share on other sites

This would be an external CSS file. You would strip out the <style></style> tags and take the rest and put that into the CSS file. You would then have the user download it with this line

<link rel="stylesheet" type="text/css" href="myfile.css">

You don't have to have the CSS in an external file, but if you plan to use it more than once in other files, then it's better to do that. .groovybutton in CSS is a selector, that selects all elements with the class name groovybutton. Whatever you do in it will affect all elements, but you can add another selector (it could be another class, and get some of the same elements with the previous class name, just add a space like this class="groovybutton someotherclass") to select those elements you want. To align, look up text-align for text, and margin/padding for non-text.

Link to comment
Share on other sites

I get what you are saying, but if i do what u suggested eg class="groovybutton mb" CSS code for mb is applied to each button individually which is not what i wantbecause I am creating a border which contains an image and fixes the buttons to the left. sorry if I am not being clear, its probably because I am not sure what i am doing :) Thanks

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...