1 link in two paragraphs in html - html

I'd like to have a link on text but the text is in 2 paragraphs (using the html editor) resulting in having 2 href's with the link i've given. Here's the regular code:
<p>google</p>
<p>dotcom</p>
and this is the result of this code how I don't want it to be:
google
dotcom
I just want a single highlight when mousing over/clicking, I tried to manually changing the code with erasing the < /a > or so but since im a newbie when it comes to html nothing good came out...
Sorry for bad english, and thanks in advance for replies.[also why are html editors online so buggy? Like the one in wordpress.. trying to do a table exactly how you want it is so annoying.]

Have you tried putting the tag around the p tags?
<a href="#">
<p>
google
</p>
<p>
dotcom
</p>
</a>
In terms of usage, HTML 5 states that the element "may be wrapped around entire paragraphs, lists, tables, and so forth, even entire sections, so long as there is no interactive content within (e.g. buttons or other links)".

Try this...
<a href="google.com">
<p>Google</p>
<p>Dotcom</p>
</a>

Related

switching between wordpress text/visual editor makes anchor tags disappear

I am trying to create anchor points in my page for users to jump to. When I create the anchor points in the text editor in wordpress, if I ever switch to visual editor, the anchor tags disappear. Here is the code I am using in the text editor:
<div>
<a id="posts" class="anchor"> </a>
<h4>Key Blog Posts</h4>
Andrea Radke-Moss, "Mormon Studies in the Classroom: Mormon Women, Patriarchy and Equality," Juvenile Instructor.
</div>
When I switch the the visual editor (regardless if I saved it or not while in text editor), the anchor tag disappears and I am left with this:
<div>
<h4>Key Blog Posts</h4>
Andrea Radke-Moss, "Mormon Studies in the Classroom: Mormon Women, Patriarchy and Equality," Juvenile Instructor.
After doing some research, this seems like a common problem with Wordpress when there is no text between the anchor tags (which is why I tried the ). Has anyone been able to conquer this problem?
Update: I tried putting a period in between the tags with style="font-size: 0px";. Saved, switched to visual editor, and the period was now outside my anchor tags! Grrrr....
I finally got something to work. Here's the code I used:
<a id="posts" class="anchor" href="#posts"> </a>
I couldn't get rid of the , so it still has a clickable spot, but at least when it's clicked on, it doesn't jump around like href="#" does.

How do you write <p></p> and display it on your site?

How do you write <p></p> so that it can be displayed as text in an HTML page, rather than be interpreted as HTML (which would give an empty paragraph).
If you want to show the in the view,
Because, when you type that inside html element, it may be getting it as the html element itself.
if your purpose is showing that in the view just try this.
&ltp> &lt/p>
Check this snippet :
&ltp> &lt/p>
you can do it with using span
<span> < </span> <span>p</span> > <span> < </span> / <span>p</span><span> > </span>
or you can do below like this
<p> </p>
A P tag should print out text on your site no matter what. However, on most occasions you will need to refresh (F5) your page in order for it to take effect. Furthermore, if you got anything on your site that could be covering it up, try removing it just to see whether another element is "eating it up" or not. For example, try removing a banner image if thats something you got, or a navbar.
Usage for P, just in case:
<p> Text goes here </p>
Use Html entities to display the reserved html symbol
HTML Entities
this is what you mean? sorry if i understand wrongly but your description is very short.
View the source of this page. It managed it!
<p><\p>
and the answer was <p><\p>

css formatting does not return to previous formatting after an <a href...>text</a> tag pair

I have a page which is not formatting properly, or at least not formatting as I expect it to.
Below is a simplified version of the code.
<div ...>
<div class="db_notes">
<pre>
Some Text.
<span class="blue">Lots more text that may be one line or multiple lines and is
retrieved from a database in preformatted form and often has one or more
links within the preformatted text.</span>
Some Additional text.
<span class="blue">More text that may be one or more lines and is reformatted
and comes from a database and often contains one or more links
within the text.</span>
And more text.
</pre>
</div>
</div>
Only the font color is changed by the <span class="blue">.
The color of the text between the <span class="blue"> and the <a href...> is blue (as desired), but the color of the text between the </a> and the </span> is black (instead of blue).
Any idea as to why, after the </a> tag, the text color does not return to blue?
Thanks!
John
* UPDATE *
First, thanks to all who created examples to test the premise that the color SHOULD be blue after the </a> tag! You proved I'm not crazy! (or not completely crazy).
I made a copy of the example at JS Bin and on the copy page pasted in a major section of the page with the text color problem. To my amazement, the text after the </a> tag is blue, as it should be.
Next I looked through the CSS to find any style elements that might affect the div, span, a, or pre tags, and put them in the CSS section on JS Bin. The resulting formatting still looks correct, with the text after the </a> tag still blue.
So then I copied the entire CSS file and pasted it into the CSS section on JS Bin. That broke it. The text after the </a> tag changed to black, which was the problem I've been having with the page.
So, somewhere in this massive CSS file there is something which is affecting how this page renders. Why, I don't know. I've always been under the impression that after an in-line closing tag the formatting should return to that in effect before the opening tag, but somehow something is changing that behavior.
It is now about 2:15 AM here, so I'm going to call it a day, get some sleep, and take a fresh look at it after some rest.
John
* UPDATE *
I've gone through the entire page making sure that all tags are matched, the nesting correct (no DIV elements inside a SPAN, etc.), and it still does not format properly.
I can't spend any more time on it, so I've come up with a kludge - close the span immediately before the <a href...> and open a new <span class="blue"> immediately after the </a>, as shown below. I know it shouldn't be necessary, but if that is what it takes to make it work, so be it. So, here is the revised simplified code.
<div ...>
<div class="db_notes">
<pre>
Some Text.
<span class="blue">Lots more text that may be one line or multiple lines and is
retrieved from a database in preformatted form and often has one or more
</span>links<span class="blue"> within the preformatted text.</span>
Some Additional text.
<span class="blue">More text that may be one or more lines and is reformatted
and comes from a database and often contains one or more
</span>links<span class="blue">
within the text.</span>
And more text.
</pre>
</div>
</div>
I still would like to know why the browsers are behaving in this manner. If anyone has any thoughts as to what is happening to cause the formatting to break down after the </a> tag, I'd love to hear them.
Thanks,
John
I couldn't get into a source code file for another project (locked for editing), so while waiting I took another look at the problem page.
In looking through the page in Firebug I noticed that while the page source has exactly one <a name="top"> tag, the Firebug display shows multiple instances of that tag. Strange.
Then I looked closer and noticed that there was no </a> tag matching the <a name="top"> tag.
After replacing:
<a name="top">
with:
<a name="top"></a>
The page works correctly!!!
At some point the web site needs to be updated to replace the:
<a name="top"></a>
...and other "a name=" tags with:
<a id="top"></a>
...tags to comply with HTML 5, but with over 2,300 dynamic pages, most with from one to thirty <a name="text"> tags, it will be a long time before there will be funding for such an effort. Another reason why some tags and options need to be supported for backward compatibility.
Thanks again to all who have contributed assistance in any form!
Best wishes,
John
The color of the text between the <span class="blue"> and the <a href...> is blue (as desired), but the color of the text between them </a> and the </span> is black (instead of blue).
If I assume you are using .blue {color: blue;} this property for span then it will change the text color blue for text which is inside the span tag. The text out of <span> will be black.
Have a look at this DEMO.
in this case, I've changed the <span> color from blue to red and you see <a> tag text is still blue which is by default.
Note: only the text inside span will be in blue color that not include the text inside the<a> tag. by default giving a link to <a> tag its change to blue color.

My basic hyperlink tag isn't working

I have a simple website, as I'm a beginner programmer. I inserted a <p> tag, which worked all fine and dandy. There was two words in the paragraph which I wanted to link to a different page on my website, and it decided it didn't want to work. I don't know why it didn't work, because I have <div> tags in the same document to the same page that were working fine.
Edit: To define what wasn't working: It wasn't clickable. It changed color, like a normal hyperlink tag should, but was just a piece of text. You just couldn't click it. Even tags with an invalid or nonexistent href should be clickable. Right? Maybe I'm wrong, again, I am a beginner.
The other strange thing was that in my CSS file, I had the text-decoration set to none, so it shouldn't have changed color in the first place.
CSS:
a{
text-decoration:none;
}
This is the HTML that I had an issue with:
<p id="p1">Ingsoc is the Newspeak word for English Socialism. (For more on Newspeak, see the Ministry of Truth page.)</p>
And here's an example of a link with the same destination that worked just fine:
<a href="TruthPage.html">
<div id="minitrue">Ministry of Truth</div>
</a>
Instead of
<a href="DifferentPage.html">
try
<a href="http://www.yoursite.com/folderpath/DifferentPage.html">
where 'yoursite.com' and 'folderpath' are changed to match your situation.
The code looks ok to me. You could try...
<p />
<div>This is just basic text that was doing what it was supposed to. This was the text that I wanted to link to a different page.
</div>
if it's working within a div tag
Your problem is that your href="DifferentPage.html" is not vailid. My suggestion is to open that other page on your site, then copy the location in the address bar.

CSS p {Indent} Leaving a gap

I am trying to make a website that has a contents page.
I use the go to chapter 1 as the contents part,
and when it clicks it does to the <a name="chapter1"><u>Chapter 1</u></a>
This works well, but there's 1 catch (there's always a catch)...
I want to make it look like the ones on Wikipedia:
[View Image][1]
[1]: http://crystalanalysis.anydns.com/images/wikipedia_contents.png
But I didn't want to copy the one from Wikipedia, I wanted to make my own,
I looked around, found the parts I needed and had 2 problems! The first problem I am
having has something to do with the Indent. I tried using the p.indent {text-indent:150px}
but it only did the indent for the line I put it before. So:
Indented text
But it was annoying having to put the Indented text before every single line in the
contents box, but it works:
<header>
p.contenttitle {text-indent:50px;}
p.contentsub {text-indent:100px;}
</header>
<body>
<div style="background-color:#FFFFFF;width:1024;border:solid 1px #000000;"><br>
<font class=Blackverdana><b>Contents:</b><br></font>
<div align="left">
<!-- CONTENTS a href --><font class=Blackverdana>
<p class=contenttitle>Chapter 00: First things first...
<p class=contentsub>Chapter 0.2 Finding the SDK for your game
<p class=contentsub>Chapter 0.3 Running the Hammer Editor
<p class=contentsub>Chapter 0.4 First Load<br><br>
</body>
The other problem I am having is that if you look at the contents page:
http://crystalanalysis.anydns.com/7-12-2013.html
you will see that there seems to be some sort of <br> after every line.
I did not plan to have those there, they just appeared. Maybe a connotation with the "p" tag?
Any help would be greatly appreciated
And also the website is a blog and I am making a Hammer Editor Tutorial if anyone was wondering.
So it seems that you aren't ending the tags when you first start them.. An example of this:
<p class=contenttitle>Chapter 00: First things first...
When in all reality it should be:
<p class=contenttitle>Chapter 00: First things first...</p>
That could be a possible issue, as well as you should really look into using a CSS page to reference your HTML. Creating a class/id will actually make that indentation process ten times easier. For more information on that I can provide a handy link from w3.org that can explain the entire process of using CSS and how it can make your life a lot easier!
http://www.w3.org/Style/Examples/011/firstcss.en.html