Ell20 Posted November 2, 2007 Share Posted November 2, 2007 Hi, Is there anyway in which I can define the location of say <h1> so that when ever I use <h1></h1> it appears in a certain location? If this is not possible is there anyway in which I can create a tag which when used displays the text into a desired position? Im not at all familiar with CSS so I have no idea how this works, would I need to call in the CSS page? Cheers for your help Elliot Quote Link to comment Share on other sites More sharing options...
bronzemonkey Posted November 2, 2007 Share Posted November 2, 2007 If I understood you correctly then what you want can be done with absolute positioning. You need to use this kind of thing in your stylesheet: h1 {position:absolute; top:100px; left:100px;} It will then be positioned 100px from the top and 100px from the left edges of the body. If you wish to absolutely position h1 relative to a containing element (such as a div), then you need to use anything other than position:static, for example use {position:relative}, to the declaration of that containing element. Google will point you to some tutorials on positioning if you want to learn about all the possibilities. Hope this answers your question. Quote Link to comment Share on other sites More sharing options...
Ell20 Posted November 3, 2007 Author Share Posted November 3, 2007 Hey thanks for your help, you understood correctly, however I cant get it to work. My CSS file is called via another file which I have called into the page using: include_once ('includes/header.html'); I no this should be calling fine as I have other CSS stuff that edits the tables, which is working fine. Then in the CSS file I added that you suggested just to check it was working but it had no effect on the positioning of the text, I tried changing the numbers but still nothing. This is an example of the code from which I want to reposition the text: $query = "INSERT INTO cricket_teams (club_id, team_name, captain, vice_captain, description) VALUES ('$id', '$team_name', '$captain', '$vice_captain', '$description')"; $result = @mysql_query ($query); if ($result) { echo '<h3>New Team Created!</h3>'; } } Thanks for your help Quote Link to comment Share on other sites More sharing options...
bronzemonkey Posted November 3, 2007 Share Posted November 3, 2007 Sorry but I cannot help you until you post the html and css for your page. The context of any element is important and I need to see what your css is doing. The fact that you seem to be using tables is also going to make this more complicated because they are a poor substitute for proper layout solutions. Quote Link to comment Share on other sites More sharing options...
Ell20 Posted November 3, 2007 Author Share Posted November 3, 2007 Just been playing around with it a bit more, I have it working properly now in the sense that the text appears in the correct location, however is there some way in which this can be centered? Its all very well using left:150px; but depending on how long the text is varies on how much it looks "aligned: center"? Cheers for your help Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.