Jump to content

CSS Help


Ell20

Recommended Posts

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

 

 

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.