Hey,

I have a question on how to make an inline style to this..:

$sqlCommand = "SELECT * FROM pages WHERE subjectid='" . $subjectid . "' AND showing='1' ORDER BY pos ASC";							//*** 
$query = mysqli_query($myConnection, $sqlCommand) or die (mysqli_error()); 															
																																	
$PageMenuDisplay = '';																												
while ($row = mysqli_fetch_array($query)) { 																						
$pid = $row["id"];																													
$pagelinklabel = $row["linklabel"];																										
$position = $row['pos'];	                                																		
/* Her sættes $sid=$subjectid ind i linket sammen med pid, sådan at pages ikke forsvinder og kan vises tilhørende det relevante subject */
$PageMenuDisplay .= '<li><a href="index.php?pid=' . $pid . '&amp;sid=' . $subjectid . '">>>> ' . $pagelinklabel . '</a></li>';}//*** 	
																																	//***	
mysqli_free_result($query);

So this gets me 5 links in total.

I gave the links a style like this:

a {border-right: 1px solid #black;}

I just need to make a border-left style (same style..) on the FIRST link that appears after the while have run through the first time.

How can I add a(inline style) left border to that, when the specific tag doesnt appear because they are being pulled from the DB?

The first link have got ID = 1 in the DB, if that is to any use?

Klemme

Member Avatar for diafol

You don't need any of that, use CSS selectors.

ul li:first-child{
   border-left: ...;
}

BTW - I don't know if it works for IE7. A !DOCTYPE is essential for IE8 though.

Thanks!

I added this:

#top_nav ul li a:first-child{border-left:1 px solid #999;}

There is more ul l on the page, so i used the id to target it.

But this is not working, there is no border, I have tjecked IE, google chrome, firefox.

Is there something wrong i the syntax?

Member Avatar for diafol
#top_nav ul li:first-child a{border-left:1 px solid #999;}

try that

Still not applying the style with that change :-/

It is possible to do this on links too right?

Member Avatar for diafol
#top_nav ul li:first-child{border-left:1px solid #999;}

You had a space between the number and the 'px'.

Aarh you see everything man!

Working and looks the way I wanted it to!

Thanks for helping out!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.