Add Text to Static Header

Is there a way to add a block text to the static header/banner on the very top of the page? I messed around with the code (even though I have no idea what I'm doing) so the text shows up but I'd like to find a way to put part of the text in a solid block with bold lettering to draw attention. Kindof like the button - but without a link. 

 

10 REPLIES
Professor

Re: Add Text to Static Header

Can you be more specific? If I understand what you're trying to achieve the simplest way to do it is by using the embed code block and having something like

<div style="text-align:center;background-color:black">
<h3 style="color:#ffffff;">My Text Goes Here</h3>
</div>

Say you have a background picture in your header, you drop this in and it will give you white colored h3 sized text that is centered, against a black background. Please correct me if I'm misunderstanding what you're trying to achieve.

 

Re: Add Text to Static Header

Hi Braybin, 

 

Thanks for replying! On the very top of my website, I've got my logo and the links/headings to the different pages. I'm trying to get text, ideally in the form of something that has a color block around it, that says "Hablamos Español"...I want it to stay on that banner/header (I don't know technically what it is called) at all times, but I want it to stand out and look different than the text for the different pages...does that make sense? Our page is still in draft form but if you want to see what I mean you can check it out...right now I have "Hablamos Español" in regular text as a landing page - but I don't want it to look the same and I don't need it to redirect to a page. 

 

Sorry if this is confusing and thanks in advance!

https://georgeandcabrera.weebly.com

Professor

Re: Add Text to Static Header

I'm pretty sure I understand your intent this time around. I had fun making this one.

 

This will require some css. First, this link has an example of what I think you want, if it isn't it, skip down to the reply and tell me to shape up! https://braybin.weebly.com/ 

 

If it is what you need, the path you will take is this:

1. You will need to target that item in the menu which is super simple to do

<style>
.wsite-menu-default li:last-child a {
    border: solid;
    font-style: italic;
    background-color: lavender;
}
.wsite-menu-default li:last-child a:hover {
    cursor:default;
    opacity: 1;
}
</style>

I tend to stick style tags in the footer of the Settings menu (Settings > SEO) when it's something simple that is also required on all pages.

2. Change your styles accordingly. Breaking down the CSS above, the first statement looks at the menu and examines the items within and it selects the last one (in this case where I'm assuming you desire the text to be). I put a simple border on it (solid produces a solid, black line about 2px I think), font-style: italic makes the text italic for flair and background-color: lavender is just something else to show you can add a lot in a small space. The statement below that starts the rules for hover behavior of the last element. Cursor default makes sure the cursor stays the usual arrow shape and opacity: 1 keeps the item from changing opacity when you hover over it. I specifically chose to make it a "Non-Clickable Menu" item so you don't have to worry about clicks leading anywhere!

 

3. Let me know if you have a very specific style in mind and I can lead you in the right direction if CSS is not something you're familiar with.

 

Good Luck!

 

Re: Add Text to Static Header

You. Are. The Best!!

 

Thank you - yes, this is pretty much what I wanted! I went ahead and copied it exactly like you said. Is there any way to get the text itself 'bold' and maybe the size of the font even a bit bigger than the other headings? I don't mind playing around with the code - I am as novice as it comes to coding (actually building this website and trying to adjust things has been the only experience I've had...so novice might be generous) - but I'm a quick learner!

 

Thanks again so much! 

Professor

Re: Add Text to Static Header

I will throw in a few more examples and some context:

<style> 
.wsite-menu-default li:last-child a {
font-weight: bold; /*sets the text to bold*/
font-weight: 500; /*there are "levels" to boldness and thickness (https://www.w3schools.com/cssref/tryit.asp?filename=trycss_font-weight)*/ font-size: 15px; /*sets the size, higher pixels = larger text. Other values can be used (pt for print media as an example) but px is the basic standard*/

/*Other areas of possible interest*/

text-decoration: underline; /*underlines the text, you can also do things like strikethroughs*/
color: red; /*sets the text color*/
background-color: blue; /*sets the background color*/
background-color: rgba(224, 78, 57, 0.7); /*sets background color by RGB values with an opacity*/
}
</style>

 As you can see, CSS gives you access to near limitless customizability to really let your creativity fly. If you need any more help or some links to reference please let me know Smiley Happy

Employee Moderator

Re: Add Text to Static Header

Thanks for being awesome, @braybin!

Re: Add Text to Static Header

@braybin thanks again so much! The only remaining issue I am having is that no matter what color I specify - it makes the changes on the editing end, but when I publish the website and send it somewhere, the box always comes out a dark blue. The dark blue color is a bit too harsh for what I'm trying to accomplish - instead I was putting in things like #0099FF or #33CCFF or a lighter blue (that would go well with the overall color scheme of the logo, etc) but it always churns out the darker default blue when I view the website elsewhere. Any insight as to why?

 

I got the boldness and weight how I want it thanks to you, so thanks so much again!

 

 

Professor

Re: Add Text to Static Header

Sure thing, always happy to help out where I can. 

 

My best guess for that is that the styling is getting caught up in your cache. Browsers like saving styles for easy loading so it doesn't have to re-download every little piece every single time. If you're on Chrome you can do CTRL + SHIFT + R or CTRL + F5 as a keyboard shortcut to clear the cache. On IE I think the CTRL + F5 will do it too. If that doesn't work you can normally access the cache reset somewhere in the history settings (again, thinking in terms of Chrome here).

 

I think that will solve the issue but I'm curious to see if the problem is persistent. Best of luck Smiley Very Happy

Professor

Re: Add Text to Static Header

@sleepwalker021, I should have looked at your site again! I know what the problem is here. CSS or Cascading Style Sheets function like a waterfall, changes flow down the style sheet. So if you have something mentioned twice over, the final mention will take precendence. Attached is a view from the Chrome Dev Tools (tools built into Chrome to allow you to see styling and other processes that are running on web pages)

2018-06-06_1421.png

 

Here you can see your "lightblue" has a strikethrough. This indicates that the style was there initially and is now overwritten by the blue that is there above. Did you perhaps paste this code snippet twice? It appears to be the case considering there are two separate instances of:

.wsite-menu-default li:last-child a

You need only to remove that second call you had and merge the styles you want to keep. As an aside, the yellow warning symbol means incorrect grammar, you need to change "font-style" to "font-weight" in order for the style to apply correctly. CSS can trip you up in so many ways in how they choose to reference certain things. So at the end of this post what you get is:

.wsite-menu-default li:last-child a {
    border: solid;
    font-weight: 700;
    text-decoration: underline;
    color: black;
    background-color: lightblue;
}

Let me know if you are still having problems with it.