How do I make the text in a php script follow the css style for the rest of the page? I have text that says "Looking for women in [city]". Where [city] is replaced by a php geoscript. But I can't figure out how to make the city name appear in the same font/color as the rest of the text.
Thanks
<p style="font-family:Verdana;color:red;">Your text here [city]</p>
css just render whatever output by php, don't get confused of these 2 wonderful languages.
if you just want the city to be a different color, place the php tags inside a span tag, then style the span tag with css. Example:
<p>Find women in <span class="citytext">ENTER YOUR PHP/JAVASCRIPT HERE</span></p>
then the css for it however you want it to be styled:
<style>
.citytext {
color: red;
whatever else you want it to look like
}
</style>
That should work.
I've played around with this code for a while and can't get it to work. I'm brand new to coding so I definitely need to spend some more time learning it. But if anyone could help me out real quick so I can get this landing page going that would be great.
Here is the code from the original file I'm trying to edit:
<span class="mid-hldr-right">
<div class="clear3"></div>
<span class="ln5">Looking for Casual Sex<br />
in Wellington?</span>
In place of Wellington I want to put the php script. So I ended up with this:
<span class="mid-hldr-right">
<div class="clear3"></div>
<span class="ln5">Looking for Casual Sex<br />
in
<?php
$geo = geoip_record_by_name( $_SERVER['REMOTE_ADDR'] );
echo "".$geo['city']."?" ;
?>
</span>
this is how ln5 is defined in the css file.
.ln5 { display:block; color:#f05f64; font-size:43px; text-align:center; font-weight:bolder; }
This should work:
[PHP]
<?php
$geo = geoip_record_by_name( $_SERVER['REMOTE_ADDR'] );
$city= $geo['city'];
?>
<style>.ln5 { display:block; color:#f05f64 !important; font-size:43px !important; text-align:center !important; font-weight:bold !important;}</style>
<span class="mid-hldr-right">
<div class="clear3"></div>
<span class="ln5">Looking for.. ahem</span><br />
<span class="ln5">in <?php echo $city; ?>?</span>
</span>[/PHP]