Skip to main content
Participating Frequently
January 14, 2019
Question

target pseudo class not working in Dreamweaver

  • January 14, 2019
  • 2 replies
  • 1780 views

Hi Folks,

I'm trying to use the target pseudo class to open/close a menu and I find that, while the code works in Firefox (version 64), it doesn't work in Dreamweaver (2018) itself. I've done a community search and see no discussion of this so I'm left thinking it's a problem with my coding, but I can't find it.

Thanks for any help/insight you can provide!

Here is my simple test: (this works on CodePen)

<style>

#bttnBox {

            width:100px;

            height:100px;

            border: 1px solid black;

            position: relative;

        }

        #openBttn {

            position: absolute;

            width:50px;

            height:50px;

            top:0px;

            left:0px;

            background-color:orange;

        }

        #closeBttn {

            position: absolute;

            width:50px;

            height:50px;

            top:0px;

            right:0px;

            background-color:aqua;

            display:none;

        }

        #closeBttn:target {

            display: block;

        }

</style>

<body>

<div id="bttnBox">

        <div><a href="#closeBttn" id="openBttn"></a></div>

        <div><a href="#body" id="closeBttn"></a></div>

    </div>

</body>

In my attempts to do this I've also transferred code for this function (menu opening) to Dreamweaver and it also doesn't work, though it works in the browser.

This topic has been closed for replies.

2 replies

pziecina
Legend
January 14, 2019

Cannot remember which key combination exactly, but you have to press ctrl or shift whilst clicking on the element. CEF, (Dw's live view engine) has required this since CEF was introduced.

ALsp
Legend
January 14, 2019

Just an FYI, but the original poster's actual posted code, when placed in a new document in Dreamweaver CS6, works in Live View

Just saying.

ALsp
Legend
January 14, 2019

ALsp  wrote

Not sure what the "error free" reference means.

Simply that the document I'm using contains no code errors.   See screenshots below.

A green checkmark in a circle denotes error free code.

A red X in a circle denotes errors.

Al things being equal, Dw CC prefers clean code.


Al things being equal, Dw CC prefers clean code.

Thanks for using my name, but what do errors have to do with this? I prefer clean code, but... well, I guess this is a classic example of how threads on this forum go off on tangents

Nice fonts and colors, by the way. Are those default? I've never seen such a thing in Dreamweaver 19 (just kidding, no need to answer).

ALsp
Legend
January 14, 2019

If you are trying to toggle between a gold and teal box, then your code works in Firefox, Chrome, and Microsoft Edge. Dreamweaver Live View should never be used to actually test a page... no matter what Adobe says

See if this page provides easier to follow examples:

https://developer.mozilla.org/en-US/docs/Web/CSS/:target

Participating Frequently
January 14, 2019

Thanks for checking it. I've seen that it works online, but I'm frustrated by it not working in Dreamweaver ... it slows the coding process down, bouncing between the program and browser. I do ultimately check things out online, but during the writing process it's confusing when there's no response in DW.

ALsp
Legend
January 14, 2019

If you set up Dreamweaver Preview In Browser then all it takes is F-12 and some habit-changing muscle memory. I've been using Dreamweaver for 22 years. It's up to you, but it's pretty much a foregone conclusion that relying on Dreamweaver's Live View can be harmful to one' sanity

I'd give Adobe 5-10 years to get Live View "optimized".

But you are the captain of your ship.