Question

Is there any way to write

<b style="color:red">asd</b>

without space after b ? like this

<bstyle="color:red">asd</b>

i want to use it as string without spaces and than i want to display it and it should work properly as html tags

i tried something like

<b&nbsp;style="color:red">asd</b> 

but it didn´t work

This is part of string in which i want to find 100th space and than using php split the string. it makes issues if i split it in the midle of tag.

Was it helpful?

Solution

You could use css.

<head>
<style type='text/css'>
b { color:red; }
</style>
</head>

//Other code

<b>abc</b>

Other idea is in the php code. Have you tried to do this?:

<?php
 $string = 'asdfasdfa<b style="color:red">asd</b> asdfasdf';
 $string2 = str_replace('<b style', '<bstyle', $string);
 //And then do the search
 $search = strpos($string2, " ", 0);
?>

OTHER TIPS

The only way to have that work is if you use str_replace on the string(s) after removing your spaces, like so:

$str = str_replace('bstyle', 'b style', $str);

where $str is a variable containing the text from which you've removed spaces.

Otherwise, the markup is invalid (and will likely be ignored by the browser).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top