简体   繁体   中英

Two CSS Questions - Removing H1 line break on wordpress

Here's my h1 problem:[link removed] i need the h1 to blend into the paragraphs perfectly for seo purposes. the tags are around Long Island.

I have the css set to h1{display: inline;padding:0;margin:0;font-weight:normal;font-size:17px;} still breaking... before. i tried adding similar stuff to "< p >" but it completely took out all the breaks, i still need some breaks!

Both H1 and P are block level elements. In order to get the effect you want, both P and H1 need to have their styles set to display: inline; .

Try:

CSS:

.inline { display: inline; }

HTML:

<p class="inline"> Welcome! My name is Nancy Lewis and I’m from </p>
<h1 class="inline"> Long Island </h1>
<p class="inline"> , New York. </p>

u can just use a H1. use a span to style specific words within your h1.

<h1>Welcome! My name is Nancy Lewis and I’m from <span>Long Island</span></h1>

Then u can style the words Long Island as you like

h1 span {font-weight:700} /*or whatever you like*/

for the second example, try to put margin yo for your body

body {margin:0}

So you need the h1 and it's immediate following p element to be inline. Simple!

The h1 :

h1 {
    display: inline;
}

The immediate following p :

h1 + p {
    display: inline;
}

What's the + up there? It's the adjacent sibling selector + . Go ahead, click the link.

That's it! But, of course, there's no need to repeat yourself. Stick the two together, and you get:

h1,
h1 + p {
    display: inline;
}

Here's a fiddle (actually, a "tinkerbin"): http://tinkerbin.com/jy3uoWX9

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM