Can this be put inside the CSS section?

Can this type of code be put in the CSS section?

<div style="visibility: hidden; position: absolute">
  <img style="visibility: hidden; position: absolute" src="http://via.placeholder.com/260x260" aria-hidden="true" alt="">
</div>

What do you suppose hidden looks like?

I was just told to do this:

.image-container{
    visibility: hidden;
    position: absolute;
 }

.image-container_image{
    visibility: hidden;
    position: absolute;
}
<div class="image-container">
   <img class="image-container_image" src="http://via.placeholder.com/260x260" aria-hidden="true" alt="">
</div>

asasass, you have been shown exactly how to do that several times by different people. I gave you a “side by side” comparison showing how to move properties from within style attributes to the CSS section about three or four weeks ago. You have shown that you know how to relate CSS within style attributes and CSS within a CSS section of the page. Why the blank to you ask someone how to do this again and again and again?

Why have you not taken a formal (classroom led) HTML and CSS class and learned the basics of HTML and CSS? That’s a sincere question.

3 Likes

It was a different set up than what I’m accustomed to, and so I was confused on how to do it. But now I know how.

What made this confusing? What made it different from all of the other examples of doing the same thing that you’ve been given?

Tell me what you know know that you did not know 10 minutes ago.

Why have you not taken a formal (classroom led) HTML and CSS class and learned the basics of HTML and CSS? That’s a sincere question.

2 Likes

Just the look of the code, and what it’s meant to do. And so, for that reason, I didn’t know if it could be put in the CSS section.

Is that a serious statement or more nonsense intended to manipulate people into writing code for you?

If that is a serious statement, then you NEED to take that formal HTML/CSS class that I keep mentioning instead of avoiding the question because CSS within “style” attributes and CSS within the CSS section of a page have not changed since we first started working with you almost two years ago.

2 Likes

I asked specifically if it could be put in the CSS section, I didn’t ask for someone to write it for me.

That’s a very important point.

If you or someone would have said yes, or of course. Then I would have tried to figure it out.

You have many free courses and paid courses and good community college courses that teach hands-on basic HTML and CSS. Why have you not taken a formal course?

Moving simple CSS properties from within HTML style attributes out to the CSS section of the page should not be a challenge at all… not for a person with your experience / exposure.

2 Likes

Would it be accurate to say that not all style attributes go in the CSS section?

No, style attributes are never within the CSS section. Style attributes are found within HTML (element) tags. The CSS properties within the style attributes can be moved out of the HTML style attributes into the CSS section and that is very routine.

5 Likes

As @ronpat says, any time you have the style attribute in your HTML: `style=“your styles here”, you can (and almost always should) move those styles to the CSS section.

3 Likes

…and when the document is completed, the internal
CSS and javascript should be placed in external files
and then linked to.

In the head section…

<link rel="stylesheet" href="css/screen.css" media="screen">

Before the closing body tag…

<script src="scripts/page.js"></script>

Your HTML file may then be considered to be finalised. :sunglasses:

Edit

@chrisofarabia

[quote]“wanted to upload a screenshot of how
this looks, but Discourse seems to be having a bad
hair day with uploads atm…”
[/quote]

Perhaps he meant something like this…

coothead

2 Likes

It’s worth clarifying (to avoid an unnecessary confusion) that as shown here, the screen.css file will be located inside a css folder, and the page.js file will be located within a scripts folder.

Edit: I’m trying to upload a screenshot of how this looks, but Discourse seems to be having a bad hair day with uploads atm…

3 Likes

In this post, I tried to use formally correct terms when referring to <style>, “styles”, properties and attributes… Ie:

<html> is a legitimate HTML tag (element)

<html style="background-color:skyblue";> is a valid HTML tag with the “style” attribute added which in turn contains the CSS property “background-color”.

<style> (with the less-than and greater-than symbols) is a valid HTML tag (element) that opens the on-page CSS section at the top of a page.

The <style> (CSS) section contains CSS rules (groups of properties). It does NOT contain “style” attributes or more <style> tags.

Informally, I commonly use the term “styles” to mean CSS properties, but I am aware of the distinctions mentioned above. I think it would be easy for asasass to be confused if the word “styles” is used informally. I’ll probably slip up. If I erred, let me know.

3 Likes

I did…

2 Likes

At last!

1 Like

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.